Program: 163265
Project: 163265
Buggy source:
/** 
 * Iterates over an input to produce instances of annotated java beans on demand.
 * @param beanType the type of java beans to be instantiated.
 * @param input    the input to be parsed
 * @param < T >      the type of java beans to be instantiated.
 * @return an {@link Iterable} that allows iterating over the input and producing instances of java beans on demand.
 */
public <T>IterableResult<T,ParsingContext> iterate(final Class<T> beanType,final Reader input){
  final Object[] beanHolder=new Object[1];
  setRowProcessor(new BeanProcessor<T>(beanType){
    @Override public void beanProcessed(    T bean,    ParsingContext context){
      beanHolder[0]=bean;
    }
    @Override public void processEnded(    ParsingContext context){
      super.processEnded(context);
      parserSettings.setRowProcessor(null);
    }
  }
);
  return new IterableResult<T,ParsingContext>(){
    private ParsingContext context;
    @Override public ParsingContext getContext(){
      return context;
    }
    @Override public ResultIterator<T,ParsingContext> iterator(){
      final AbstractParser<P> parser=createParser(parserSettings);
      parser.beginParsing(input);
      context=parser.getContext();
      parser.parseNext();
      return new ResultIterator<T,ParsingContext>(){
        @Override public boolean hasNext(){
          return !parser.getContext().isStopped() || beanHolder[0] != null;
        }
        @Override public T next(){
          T out=(T)beanHolder[0];
          if (parser.parseNext() == null) {
            beanHolder[0]=null;
          }
          return out;
        }
        @Override public void remove(){
          throw new UnsupportedOperationException("String_Node_Str");
        }
        @Override public ParsingContext getContext(){
          return context;
        }
      }
;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Iterates over an input to produce instances of annotated java beans on demand.
 * @param beanType the type of java beans to be instantiated.
 * @param input    the input to be parsed
 * @param < T >      the type of java beans to be instantiated.
 * @return an {@link Iterable} that allows iterating over the input and producing instances of java beans on demand.
 */
public <T>IterableResult<T,ParsingContext> iterate(final Class<T> beanType,final Reader input){
  final Object[] beanHolder=new Object[1];
  setRowProcessor(new BeanProcessor<T>(beanType){
    @Override public void beanProcessed(    T bean,    ParsingContext context){
      beanHolder[0]=bean;
    }
    @Override public void processEnded(    ParsingContext context){
      super.processEnded(context);
      parserSettings.setRowProcessor(null);
    }
  }
);
  return new IterableResult<T,ParsingContext>(){
    private ParsingContext context;
    @Override public ParsingContext getContext(){
      return context;
    }
    @Override public ResultIterator<T,ParsingContext> iterator(){
      final AbstractParser<P> parser=createParser(parserSettings);
      parser.beginParsing(input);
      context=parser.getContext();
      return new ResultIterator<T,ParsingContext>(){
        @Override public boolean hasNext(){
          return beanHolder[0] != null || parser.parseNext() != null;
        }
        @Override public T next(){
          if (hasNext()) {
            T out=(T)beanHolder[0];
            beanHolder[0]=null;
            return out;
          }
          return null;
        }
        @Override public void remove(){
          throw new UnsupportedOperationException("String_Node_Str");
        }
        @Override public ParsingContext getContext(){
          return context;
        }
      }
;
    }
  }
;
}