nus-yam/ex-repair huggingface dataset:
Program: 88902
Project: 88902
Buggy source:
@Override public void startProcessing(ItemStatus status) throws IOException {
  LOG.trace("String_Node_Str");
  if (getContext().getOutputMode() == OutputMode.JAVASCRIPT) {
    getWriter().writeComment(startComment);
    getWriter().writeVariable(namespaceName,"String_Node_Str",JavaScriptWriter.VariableType.BLOCK);
  }
 else {
    getWriter().startBlock();
  }
  getWriter().indent();
}

Fixed version (ground truth):
@Override public void startProcessing(ItemStatus status) throws IOException {
  LOG.trace("String_Node_Str");
  if (getContext().getOutputMode() == OutputMode.JAVASCRIPT) {
    getWriter().writeComment(startComment);
    getWriter().writeVariable(namespaceName,"String_Node_Str",JavaScriptWriter.VariableType.BLOCK);
    getWriter().indent();
  }
 else {
    getWriter().startBlock();
  }
}
Program: 88903
Project: 88903
Buggy source:
@Test public void testProcessFirstModel() throws Exception {
  ModelProcessor processor=createProcessor();
  Model model=mockModel();
  processor.doProcessModel(model,ItemStatuses.first());
  assertThat(writer.toString(),is("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testProcessFirstModel() throws Exception {
  ModelProcessor processor=createProcessor();
  Model model=mockModel();
  processor.doProcessModel(model,ItemStatuses.first());
  assertThat(writer.toString(),is("String_Node_Str" + "String_Node_Str" + "String_Node_Str"));
}
Program: 88904
Project: 88904
Buggy source:
@Test public void testProcessLastModel() throws Exception {
  ModelProcessor processor=createProcessor();
  Model model=mockModel();
  processor.doProcessModel(model,ItemStatuses.last());
  assertThat(writer.toString(),is("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testProcessLastModel() throws Exception {
  ModelProcessor processor=createProcessor();
  Model model=mockModel();
  processor.doProcessModel(model,ItemStatuses.last());
  assertThat(writer.toString(),is("String_Node_Str" + "String_Node_Str" + "String_Node_Str"));
}
Program: 88905
Project: 88905
Buggy source:
@Test public void testProcessMiddleModel() throws Exception {
  ModelProcessor processor=createProcessor();
  Model model=mockModel();
  processor.doProcessModel(model,ItemStatuses.notFirstNorLast());
  assertThat(writer.toString(),is("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testProcessMiddleModel() throws Exception {
  ModelProcessor processor=createProcessor();
  Model model=mockModel();
  processor.doProcessModel(model,ItemStatuses.notFirstNorLast());
  assertThat(writer.toString(),is("String_Node_Str" + "String_Node_Str" + "String_Node_Str"));
}
Program: 88906
Project: 88906
Buggy source:
@Test public void testProcessFirstModel() throws Exception {
  ModelProcessor processor=createProcessor();
  Model model=mockModel();
  processor.doProcessModel(model,ItemStatuses.first());
  assertThat(writer.toString(),is("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testProcessFirstModel() throws Exception {
  ModelProcessor processor=createProcessor();
  Model model=mockModel();
  processor.doProcessModel(model,ItemStatuses.first());
  assertThat(writer.toString(),is("String_Node_Str" + "String_Node_Str" + "String_Node_Str"));
}
Program: 88907
Project: 88907
Buggy source:
@Test public void testProcessLastModel() throws Exception {
  ModelProcessor processor=createProcessor();
  Model model=mockModel();
  processor.doProcessModel(model,ItemStatuses.last());
  assertThat(writer.toString(),is("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testProcessLastModel() throws Exception {
  ModelProcessor processor=createProcessor();
  Model model=mockModel();
  processor.doProcessModel(model,ItemStatuses.last());
  assertThat(writer.toString(),is("String_Node_Str" + "String_Node_Str" + "String_Node_Str"));
}
Program: 88908
Project: 88908
Buggy source:
@Test public void testProcessMiddleModel() throws Exception {
  ModelProcessor processor=createProcessor();
  Model model=mockModel();
  processor.doProcessModel(model,ItemStatuses.notFirstNorLast());
  assertThat(writer.toString(),is("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testProcessMiddleModel() throws Exception {
  ModelProcessor processor=createProcessor();
  Model model=mockModel();
  processor.doProcessModel(model,ItemStatuses.notFirstNorLast());
  assertThat(writer.toString(),is("String_Node_Str" + "String_Node_Str" + "String_Node_Str"));
}
Program: 88909
Project: 88909
Buggy source:
@Before public void init(){
  writer=new StringBufferWriter();
  jsWriter=new JavaScriptWriter(writer);
  context=new JavaScriptContext(jsWriter,getMode());
  MockitoAnnotations.initMocks(this);
  when(validatorProcessor.getName()).thenReturn("String_Node_Str");
  when(valueProcessor.getName()).thenReturn("String_Node_Str");
  Answer<Object> writeEmptyBlock=new Answer<Object>(){
    @Override public Object answer(    InvocationOnMock invocation) throws Throwable {
      ItemStatus status=(ItemStatus)invocation.getArguments()[1];
      if (status.isNotLastItem()) {
        writer.write("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
      }
 else {
        writer.write("String_Node_Str" + "String_Node_Str");
      }
      return null;
    }
  }
;
  doAnswer(writeEmptyBlock).when(validatorProcessor).doProcessModel(any(Model.class),any(ItemStatus.class));
  doAnswer(writeEmptyBlock).when(valueProcessor).doProcessModel(any(Model.class),any(ItemStatus.class));
}

Fixed version (ground truth):
@Before public void init(){
  writer=new StringBufferWriter();
  jsWriter=new JavaScriptWriter(writer);
  context=new JavaScriptContext(jsWriter,getMode());
  MockitoAnnotations.initMocks(this);
  when(validatorProcessor.getName()).thenReturn("String_Node_Str");
  when(valueProcessor.getName()).thenReturn("String_Node_Str");
  Answer<Object> writeEmptyBlock=new Answer<Object>(){
    @Override public Object answer(    InvocationOnMock invocation) throws Throwable {
      ItemStatus status=(ItemStatus)invocation.getArguments()[1];
      if (status.isNotLastItem()) {
        writer.write("String_Node_Str");
      }
 else {
        writer.write("String_Node_Str");
      }
      return null;
    }
  }
;
  doAnswer(writeEmptyBlock).when(validatorProcessor).doProcessModel(any(Model.class),any(ItemStatus.class));
  doAnswer(writeEmptyBlock).when(valueProcessor).doProcessModel(any(Model.class),any(ItemStatus.class));
}
Program: 88910
Project: 88910
Buggy source:
@Override public Object answer(InvocationOnMock invocation) throws Throwable {
  ItemStatus status=(ItemStatus)invocation.getArguments()[1];
  if (status.isNotLastItem()) {
    writer.write("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
 else {
    writer.write("String_Node_Str" + "String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
@Override public Object answer(InvocationOnMock invocation) throws Throwable {
  ItemStatus status=(ItemStatus)invocation.getArguments()[1];
  if (status.isNotLastItem()) {
    writer.write("String_Node_Str");
  }
 else {
    writer.write("String_Node_Str");
  }
  return null;
}
Program: 88911
Project: 88911
Buggy source:
private void generateModelAndAddToCache(String internalModelName){
  Model model=modelsByName.get(internalModelName);
  modelGenerator.process(model);
  String modelData=getLanguageContext().getWriter().toString();
  generatedModelsByName.put(internalModelName,modelData);
  getLanguageContext().getWriter().clear();
}

Fixed version (ground truth):
private synchronized void generateModelAndAddToCache(String internalModelName){
  Model model=modelsByName.get(internalModelName);
  modelGenerator.process(model);
  String modelData=getLanguageContext().getWriter().toString();
  generatedModelsByName.put(internalModelName,modelData);
  getLanguageContext().getWriter().clear();
}
Program: 88912
Project: 88912
Buggy source:
@Override public void setLanguageContext(LanguageContext<W> context){
  this.context=context;
  modelProcessor.setLanguageContext(context);
}

Fixed version (ground truth):
@Override public void setLanguageContext(LanguageContext<W> context){
  modelProcessor.setLanguageContext(context);
}
Program: 88913
Project: 88913
Buggy source:
public static final DummyDataWriter getInstance(){
  return DUMMY_DATA_WRITER;
}

Fixed version (ground truth):
public static DummyDataWriter getInstance(){
  return DUMMY_DATA_WRITER;
}
Program: 88914
Project: 88914
Buggy source:
/** 
 * Constructs a combined validator factory. It requires at least one  {@link ValidatorFactory}.
 * @param validatorFactory Required validator factory
 * @param additionalFactories Additional validator factories
 */
public CombinedValidatorFactory(ValidatorFactory validatorFactory,ValidatorFactory... additionalFactories){
  validatorFactories.add(validatorFactory);
  for (  ValidatorFactory additionalFactory : additionalFactories) {
    validatorFactories.add(additionalFactory);
  }
}

Fixed version (ground truth):
/** 
 * Constructs a combined validator factory. It requires at least one  {@link ValidatorFactory}.
 * @param validatorFactory Required validator factory
 * @param additionalFactories Additional validator factories
 */
public CombinedValidatorFactory(ValidatorFactory validatorFactory,ValidatorFactory... additionalFactories){
  validatorFactories.add(validatorFactory);
  Collections.addAll(validatorFactories,additionalFactories);
}
Program: 88915
Project: 88915
Buggy source:
private List<Class> breakDownGenericGroupsToLeaves(Collection<Class> requiredGroups){
  final List<Class> groupTreeLeaves=new ArrayList<Class>();
  for (  Class group : requiredGroups) {
    addLeavesToList((Class)group,(List)groupTreeLeaves);
  }
  return groupTreeLeaves;
}

Fixed version (ground truth):
private List<Class> breakDownGenericGroupsToLeaves(Collection<Class> requiredGroups){
  final List<Class> groupTreeLeaves=new ArrayList<Class>();
  for (  Class group : requiredGroups) {
    addLeavesToList(group,(List)groupTreeLeaves);
  }
  return groupTreeLeaves;
}
Program: 88916
Project: 88916
Buggy source:
private List<Class> breakDownClassesGroupTreeLeaves(Class[] groupsGiven){
  final List<Class> groupsToCheck=new ArrayList<Class>();
  if (groupsGiven.length > 0) {
    for (    Class groupGiven : groupsGiven) {
      addLeavesToList((Class)groupGiven,groupsToCheck);
    }
  }
  return groupsToCheck;
}

Fixed version (ground truth):
private List<Class> breakDownClassesGroupTreeLeaves(Class[] groupsGiven){
  final List<Class> groupsToCheck=new ArrayList<Class>();
  if (groupsGiven.length > 0) {
    for (    Class groupGiven : groupsGiven) {
      addLeavesToList(groupGiven,groupsToCheck);
    }
  }
  return groupsToCheck;
}
Program: 88917
Project: 88917
Buggy source:
/** 
 * Update the processing
 * @param itemIndex 0 based index.
 */
final private void updateInternal(int itemIndex){
  firstItem=itemIndex == 0;
  lastItem=itemIndex == (numberOfItems - 1);
}

Fixed version (ground truth):
/** 
 * Update the processing
 * @param itemIndex 0 based index.
 */
private void updateInternal(int itemIndex){
  firstItem=itemIndex == 0;
  lastItem=itemIndex == (numberOfItems - 1);
}
Program: 88918
Project: 88918
Buggy source:
protected void flush(){
  try {
    this.writer.flush();
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
protected void flush(){
  try {
    this.writer.flush();
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
}
Program: 88919
Project: 88919
Buggy source:
/** 
 * Manager requires an implemented DataWriter, TestWriter. TestValidatorWriter also uses this same TestWriter
 */
@Test public void testWithImplementedDataWriter(){
class TestWriter extends StreamDataWriter {
  }
class TestValidator extends BaseValidator {
    @Override public void init(    AnnotationBag annotationBag){
    }
  }
class TestValidatorWriter extends BaseValidatorWriter<TestValidator,LanguageContext<TestWriter>,TestWriter> {
    @Override protected void write(    LanguageContext<TestWriter> languageContext,    TestValidator validator,    ItemStatus status){
    }
  }
  ValidatorWriterSet manager=new ValidatorWriterSet(Arrays.asList(new TestValidatorWriter()));
}

Fixed version (ground truth):
/** 
 * Manager requires an implemented DataWriter, TestWriter. TestValidatorWriter also uses this same TestWriter
 */
@Test public void testWithImplementedDataWriter(){
class TestWriter extends StreamDataWriter {
  }
class TestValidator extends BaseValidator {
    @Override public void init(    AnnotationBag annotationBag){
    }
  }
class TestValidatorWriter extends BaseValidatorWriter<TestValidator,LanguageContext<TestWriter>,TestWriter> {
    @Override protected void write(    LanguageContext<TestWriter> languageContext,    TestValidator validator,    ItemStatus status){
    }
  }
  new ValidatorWriterSet(Arrays.asList(new TestValidatorWriter()));
}
Program: 88920
Project: 88920
Buggy source:
/** 
 * Every class uses plain DataWriter interface
 */
@Test public void testWithPlainDataWriterInterface(){
class TestValidator extends BaseValidator {
    @Override public void init(    AnnotationBag annotationBag){
    }
  }
class TestValidatorWriter extends BaseValidatorWriter<TestValidator,LanguageContext<DataWriter>,DataWriter> {
    @Override protected void write(    LanguageContext<DataWriter> languageContext,    TestValidator validator,    ItemStatus status){
    }
  }
  ValidatorWriterSet manager=new ValidatorWriterSet(Arrays.asList(new TestValidatorWriter()));
}

Fixed version (ground truth):
/** 
 * Every class uses plain DataWriter interface
 */
@Test public void testWithPlainDataWriterInterface(){
class TestValidator extends BaseValidator {
    @Override public void init(    AnnotationBag annotationBag){
    }
  }
class TestValidatorWriter extends BaseValidatorWriter<TestValidator,LanguageContext<DataWriter>,DataWriter> {
    @Override protected void write(    LanguageContext<DataWriter> languageContext,    TestValidator validator,    ItemStatus status){
    }
  }
  new ValidatorWriterSet(Arrays.asList(new TestValidatorWriter()));
}
Program: 88921
Project: 88921
Buggy source:
@Test public void testConstructModelNoFields() throws Exception {
class TestModelClass {
  }
  ;
  Collection<ModelField> modelFields=Collections.emptyList();
  Model model=new Model(TestModelClass.class,"String_Node_Str",modelFields);
  assertEquals("String_Node_Str",model.getName());
  assertEquals(TestModelClass.class,model.getModelClass());
  assertTrue(model.getFields().isEmpty());
  assertFalse(model.hasValidations());
}

Fixed version (ground truth):
@Test public void testConstructModelNoFields() throws Exception {
class TestModelClass {
  }
  Collection<ModelField> modelFields=Collections.emptyList();
  Model model=new Model(TestModelClass.class,"String_Node_Str",modelFields);
  assertEquals("String_Node_Str",model.getName());
  assertEquals(TestModelClass.class,model.getModelClass());
  assertTrue(model.getFields().isEmpty());
  assertFalse(model.hasValidations());
}
Program: 88922
Project: 88922
Buggy source:
@Test public void testConstructModelValidations() throws Exception {
class TestModelClass {
  }
  ;
  ModelField fieldWithoutValidation=mock(ModelField.class);
  when(fieldWithoutValidation.hasValidators()).thenReturn(false);
  ModelField fieldWithValidation=mock(ModelField.class);
  when(fieldWithoutValidation.hasValidators()).thenReturn(true);
  Model model=new Model(TestModelClass.class,"String_Node_Str",TestUtil.collectionFromObjects(fieldWithoutValidation,fieldWithValidation));
  assertEquals("String_Node_Str",model.getName());
  assertEquals(TestModelClass.class,model.getModelClass());
  assertEquals(2,model.getFields().size());
  assertTrue(model.hasValidations());
}

Fixed version (ground truth):
@Test public void testConstructModelValidations() throws Exception {
class TestModelClass {
  }
  ModelField fieldWithoutValidation=mock(ModelField.class);
  when(fieldWithoutValidation.hasValidators()).thenReturn(false);
  ModelField fieldWithValidation=mock(ModelField.class);
  when(fieldWithoutValidation.hasValidators()).thenReturn(true);
  Model model=new Model(TestModelClass.class,"String_Node_Str",TestUtil.collectionFromObjects(fieldWithoutValidation,fieldWithValidation));
  assertEquals("String_Node_Str",model.getName());
  assertEquals(TestModelClass.class,model.getModelClass());
  assertEquals(2,model.getFields().size());
  assertTrue(model.hasValidations());
}
Program: 88923
Project: 88923
Buggy source:
@Test public void testConstructModelNoValidations() throws Exception {
class TestModelClass {
  }
  ;
  ModelField fieldWithoutValidation1=mock(ModelField.class);
  when(fieldWithoutValidation1.hasValidators()).thenReturn(false);
  ModelField fieldWithoutValidation2=mock(ModelField.class);
  when(fieldWithoutValidation1.hasValidators()).thenReturn(false);
  Model model=new Model(TestModelClass.class,"String_Node_Str",TestUtil.collectionFromObjects(fieldWithoutValidation1,fieldWithoutValidation2));
  assertEquals("String_Node_Str",model.getName());
  assertEquals(TestModelClass.class,model.getModelClass());
  assertEquals(2,model.getFields().size());
  assertFalse(model.hasValidations());
}

Fixed version (ground truth):
@Test public void testConstructModelNoValidations() throws Exception {
class TestModelClass {
  }
  ModelField fieldWithoutValidation1=mock(ModelField.class);
  when(fieldWithoutValidation1.hasValidators()).thenReturn(false);
  ModelField fieldWithoutValidation2=mock(ModelField.class);
  when(fieldWithoutValidation1.hasValidators()).thenReturn(false);
  Model model=new Model(TestModelClass.class,"String_Node_Str",TestUtil.collectionFromObjects(fieldWithoutValidation1,fieldWithoutValidation2));
  assertEquals("String_Node_Str",model.getName());
  assertEquals(TestModelClass.class,model.getModelClass());
  assertEquals(2,model.getFields().size());
  assertFalse(model.hasValidations());
}
Program: 88924
Project: 88924
Buggy source:
@Test public void testOneItemInArray(){
  StringBuilder sb=new StringBuilder();
  LastItemCaller lic=new LastItemCaller();
  ItemHandler<String> itemProcessor=getItemProcessor(sb,lic);
  ItemProcessor.process(itemProcessor,new String[]{"String_Node_Str"});
  assertEquals("String_Node_Str",sb.toString());
  assertEquals(1,lic.calledWithLastTrue);
  assertEquals(0,lic.calledWithLastFalse);
}

Fixed version (ground truth):
@Test public void testOneItemInArray(){
  StringBuilder sb=new StringBuilder();
  LastItemCaller lic=new LastItemCaller();
  ItemHandler<String> itemProcessor=getItemProcessor(sb,lic);
  ItemProcessor.process(itemProcessor,"String_Node_Str");
  assertEquals("String_Node_Str",sb.toString());
  assertEquals(1,lic.calledWithLastTrue);
  assertEquals(0,lic.calledWithLastFalse);
}
Program: 88925
Project: 88925
Buggy source:
@Test public void testMultipleItemsInArray(){
  StringBuilder sb=new StringBuilder();
  LastItemCaller lic=new LastItemCaller();
  ItemHandler<String> itemProcessor=getItemProcessor(sb,lic);
  ItemProcessor.process(itemProcessor,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  assertEquals("String_Node_Str",sb.toString());
  assertEquals(1,lic.calledWithLastTrue);
  assertEquals(3,lic.calledWithLastFalse);
}

Fixed version (ground truth):
@Test public void testMultipleItemsInArray(){
  StringBuilder sb=new StringBuilder();
  LastItemCaller lic=new LastItemCaller();
  ItemHandler<String> itemProcessor=getItemProcessor(sb,lic);
  ItemProcessor.process(itemProcessor,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  assertEquals("String_Node_Str",sb.toString());
  assertEquals(1,lic.calledWithLastTrue);
  assertEquals(3,lic.calledWithLastFalse);
}
Program: 88926
Project: 88926
Buggy source:
/** 
 * Generates a List from the given objects
 * @param objects Object to include in the list
 * @param < T > Type of list
 * @return List containing the given objects. Empty list if no objects given.
 */
public static <T>List<T> listFromObjects(T... objects){
  List<T> arrayList=new ArrayList<T>(objects.length);
  for (  T t : objects) {
    arrayList.add(t);
  }
  return arrayList;
}

Fixed version (ground truth):
/** 
 * Generates a List from the given objects
 * @param objects Object to include in the list
 * @param < T > Type of list
 * @return List containing the given objects. Empty list if no objects given.
 */
public static <T>List<T> listFromObjects(T... objects){
  List<T> arrayList=new ArrayList<T>(objects.length);
  Collections.addAll(arrayList,objects);
  return arrayList;
}
Program: 88927
Project: 88927
Buggy source:
/** 
 * Generates a List from the given objects
 * @param objects Object to include in the list
 * @param < T > Type of list
 * @return List containing the given objects. Empty list if no objects given.
 */
public static <T>Collection<T> collectionFromObjects(T... objects){
  Collection<T> arrayList=new ArrayList<T>(objects.length);
  for (  T t : objects) {
    arrayList.add(t);
  }
  return arrayList;
}

Fixed version (ground truth):
/** 
 * Generates a List from the given objects
 * @param objects Object to include in the list
 * @param < T > Type of list
 * @return List containing the given objects. Empty list if no objects given.
 */
public static <T>Collection<T> collectionFromObjects(T... objects){
  Collection<T> arrayList=new ArrayList<T>(objects.length);
  Collections.addAll(arrayList,objects);
  return arrayList;
}
Program: 88928
Project: 88928
Buggy source:
@Test(expected=AssertionError.class) public void testPatternAnnotationProcessorNullFlags(){
  Pattern.Flag[] flags=null;
  String result=JavaToJSPatternConverter.convertFromJava("String_Node_Str",flags);
}

Fixed version (ground truth):
@Test(expected=AssertionError.class) public void testPatternAnnotationProcessorNullFlags(){
  Pattern.Flag[] flags=null;
  JavaToJSPatternConverter.convertFromJava("String_Node_Str",flags);
}
Program: 88929
Project: 88929
Buggy source:
@Test(expected=AssertionError.class) public void testPatternAnnotationProcessorNull(){
  String result=JavaToJSPatternConverter.convertFromJava(null);
}

Fixed version (ground truth):
@Test(expected=AssertionError.class) public void testPatternAnnotationProcessorNull(){
  JavaToJSPatternConverter.convertFromJava(null);
}
Program: 88930
Project: 88930
Buggy source:
@Test(expected=AssertionError.class) public void testPatternAnnotationProcessorNull_JSON(){
  String result=JavaToJSPatternConverter.convertFromJavaToJSON(null);
}

Fixed version (ground truth):
@Test(expected=AssertionError.class) public void testPatternAnnotationProcessorNull_JSON(){
  JavaToJSPatternConverter.convertFromJavaToJSON(null);
}
Program: 88932
Project: 88932
Buggy source:
/** 
 * Writes function arguments and starts block
 * @param arguments Function arguments
 * @return Writer itself for chaining writes
 */
private JavaScriptWriter writeFunctionArgsAndStartBlock(String name,String... arguments){
  startFunctionCall(name);
  ItemHandler<String> argumentProcessor=new ItemHandler<String>(){
    @Override public void process(    String argument,    ItemStatus status){
      write(argument,LIST_SEPARATOR + space,status.isNotLastItem());
    }
  }
;
  ItemProcessor.process(argumentProcessor,arguments);
  endFunctionCall().writeSpace();
  return startBlock();
}

Fixed version (ground truth):
/** 
 * Writes function arguments and starts block
 * @param arguments Function arguments
 * @return Writer itself for chaining writes
 */
private JavaScriptWriter writeFunctionArgsAndStartBlock(String name,String... arguments){
  ++functionsOpen;
  startFunctionCall(name);
  ItemHandler<String> argumentProcessor=new ItemHandler<String>(){
    @Override public void process(    String argument,    ItemStatus status){
      write(argument,LIST_SEPARATOR + space,status.isNotLastItem());
    }
  }
;
  ItemProcessor.process(argumentProcessor,arguments);
  endFunctionCall().writeSpace();
  return startBlock();
}
Program: 88933
Project: 88933
Buggy source:
@Override public void processModel(final Model model,ItemStatus status){
  LOG.trace("String_Node_Str",model.toString());
  String modelName=model.getName();
  if (mode == Mode.FULL) {
    getWriter().write(modelName).writeLine(MODEL_EXTEND_START).indent();
  }
 else {
    getWriter().write(modelName).write("String_Node_Str").writeLine(BLOCK_START).indent();
  }
  ItemProcessor.process(modelProcessors).with(new ItemHandler<ModelProcessor<JavaScriptWriter>>(){
    @Override public void process(    ModelProcessor<JavaScriptWriter> item,    ItemStatus status){
      writeSection(item.getName(),model,item,status);
    }
  }
);
  getWriter().indentBack();
  if (mode == Mode.FULL) {
    getWriter().writeLine(MODEL_EXTEND_END,"String_Node_Str",status.isNotLastItem());
  }
 else {
    getWriter().writeLine(BLOCK_END,"String_Node_Str",status.isNotLastItem());
  }
}

Fixed version (ground truth):
@Override public void processModel(final Model model,ItemStatus status){
  LOG.trace("String_Node_Str",model.toString());
  String modelName=model.getName();
  if (mode == Mode.FULL) {
    getWriter().write(modelName).writeLine(MODEL_EXTEND_START).indent();
  }
 else {
    getWriter().writeKey(modelName).writeLine(BLOCK_START).indent();
  }
  ItemProcessor.process(modelProcessors).with(new ItemHandler<ModelProcessor<JavaScriptWriter>>(){
    @Override public void process(    ModelProcessor<JavaScriptWriter> item,    ItemStatus status){
      writeSection(item.getName(),model,item,status);
    }
  }
);
  getWriter().indentBack();
  if (mode == Mode.FULL) {
    getWriter().writeLine(MODEL_EXTEND_END,"String_Node_Str",status.isNotLastItem());
  }
 else {
    getWriter().writeLine(BLOCK_END,"String_Node_Str",status.isNotLastItem());
  }
}
Program: 88934
Project: 88934
Buggy source:
private void initRest(List<ModelProcessor<JavaScriptWriter>> validatorProcessor,Mode mode){
  this.startComment=DEFAULT_START_COMMENT;
  this.namespaceName=DEFAULT_NAMESPACE;
  this.modelProcessors.addAll(validatorProcessor);
  this.mode=mode;
  for (  ModelProcessor<JavaScriptWriter> processor : validatorProcessor) {
    processor.setWriter(getWriter());
  }
}

Fixed version (ground truth):
private void initRest(List<ModelProcessor<JavaScriptWriter>> validatorProcessor,Mode mode){
  this.startComment=DEFAULT_START_COMMENT;
  this.namespaceName=DEFAULT_NAMESPACE;
  this.modelProcessors.addAll(validatorProcessor);
  this.mode=mode;
  for (  ModelProcessor<JavaScriptWriter> processor : validatorProcessor) {
    processor.setWriter(getWriter());
  }
  if (mode == Mode.JSON) {
    getWriter().setJSONmode(true);
  }
}
Program: 88935
Project: 88935
Buggy source:
/** 
 * Writes object key (also the separator, default ":")
 * @param key Key name
 * @return Writer itself for chaining writes
 */
public JavaScriptWriter writeKey(String key){
  return write(key).write(KEY_VALUE_SEPARATOR);
}

Fixed version (ground truth):
/** 
 * Writes object key (also the separator, default ":")
 * @param key Key name
 * @return Writer itself for chaining writes
 */
public JavaScriptWriter writeKey(String key){
  return write("String_Node_Str","String_Node_Str",JSONmode).write(key,"String_Node_Str",JSONmode).write(KEY_VALUE_SEPARATOR);
}
Program: 88936
Project: 88936
Buggy source:
/** 
 * Constructs and initializes the validator
 * @param annotationBag Annotations to give to the init method
 * @return Initialized validator
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 * @throws NoSuchMethodException
 */
private Validator constructAndInitValidator(AnnotationBag annotationBag) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
  final Validator validatorInstance=(Validator)validatorClass.getConstructor().newInstance();
  validatorInstance.init(annotationBag);
  return validatorInstance;
}

Fixed version (ground truth):
/** 
 * Constructs and initializes the validator
 * @param annotationBag Annotations to give to the init method
 * @return Initialized validator
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 * @throws NoSuchMethodException
 */
private Validator constructAndInitValidator(AnnotationBag annotationBag) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
  final BaseValidator validatorInstance=(BaseValidator)validatorClass.getConstructor().newInstance();
  validatorInstance.init(annotationBag);
  return validatorInstance;
}
Program: 88937
Project: 88937
Buggy source:
@Override public void init(AnnotationBag annotationBag){
  if (annotationBag.hasAnnotation(Min.class)) {
    hasMin=true;
    min=annotationBag.getAnnotation(Min.class).value();
  }
  if (annotationBag.hasAnnotation(Max.class)) {
    hasMax=true;
    max=annotationBag.getAnnotation(Max.class).value();
  }
}

Fixed version (ground truth):
@InitMethod public void init(Max max){
  hasMax=true;
  this.max=max.value();
}
Program: 88938
Project: 88938
Buggy source:
@Override public void init(AnnotationBag annotationBag){
  Pattern pattern=annotationBag.getAnnotation(Pattern.class);
  this.flags=pattern.flags();
  if (annotationBag.hasAnnotation(OverridePattern.class)) {
    OverridePattern overriddenPattern=annotationBag.getAnnotation(OverridePattern.class);
    regexp=overriddenPattern.regexp();
  }
 else {
    regexp=pattern.regexp();
  }
}

Fixed version (ground truth):
@InitMethod public void init(OverridePattern overridePattern){
  this.regexp=overridePattern.regexp();
}
Program: 88939
Project: 88939
Buggy source:
@Override public void init(AnnotationBag annotationBag){
  Size size=annotationBag.getAnnotation(Size.class);
  this.min=size.min();
  this.max=size.max();
  this.hasMin=min >= 0;
  this.hasMax=max < Integer.MAX_VALUE;
}

Fixed version (ground truth):
@InitMethod public void init(Size size){
  this.min=size.min();
  this.max=size.max();
  this.hasMin=min >= 0;
  this.hasMax=max < Integer.MAX_VALUE;
}
Program: 88940
Project: 88940
Buggy source:
/** 
 * Scans the given class for model fields. Accesses field directly via member variables.
 * @param clazz Class to scan
 * @return List of model fields. Empty list if nothing found.
 * @throws CannotAccessDefaultConstructorError If the default constructor exists but cannot be accessed
 * @throws DefaultConstructorMissingError If the given model does not have a default constructor
 */
private List<ModelField> getFieldsByDirectFieldAccess(Class clazz){
  List<ModelField> fields=new ArrayList<ModelField>();
  for (  Field field : clazz.getDeclaredFields()) {
    final boolean wasAccessible=field.isAccessible();
    field.setAccessible(true);
    if (shouldAddField(field)) {
      ModelField modelField=new ModelField(field,validatorScanner.getValidators(field));
      fields.add(modelField);
    }
 else {
      LOG.warn("String_Node_Str",field.getName());
    }
    field.setAccessible(wasAccessible);
  }
  return fields;
}

Fixed version (ground truth):
/** 
 * Scans the given class for model fields. Accesses field directly via member variables.
 * @param clazz Class to scan
 * @return List of model fields. Empty list if nothing found.
 * @throws CannotAccessDefaultConstructorError If the default constructor exists but cannot be accessed
 * @throws DefaultConstructorMissingError If the given model does not have a default constructor
 */
private List<ModelField> getFieldsByDirectFieldAccess(Class clazz){
  List<ModelField> fields=new ArrayList<ModelField>();
  for (  Field field : clazz.getDeclaredFields()) {
    final boolean wasAccessible=field.isAccessible();
    field.setAccessible(true);
    if (shouldAddField(field)) {
      ModelField modelField=new ModelField(field,validatorScanner.getValidators(field));
      fields.add(modelField);
    }
 else {
      LOG.warn("String_Node_Str",field.getName());
    }
    field.setAccessible(wasAccessible);
  }
  if (clazz.getSuperclass() != null && !clazz.getSuperclass().equals(Object.class)) {
    fields.addAll(getFieldsByDirectFieldAccess(clazz.getSuperclass()));
  }
  return fields;
}
Program: 88941
Project: 88941
Buggy source:
/** 
 * Scans the given class for model fields. Accesses bean properties (getter methods).
 * @param clazz Class to scan
 * @return List of model fields. Empty list if nothing found.
 * @throws CannotAccessDefaultConstructorError If the default constructor exists but cannot be accessed
 * @throws DefaultConstructorMissingError If the given model does not have a default constructor
 */
private List<ModelField> getFieldsByGetters(Class clazz){
  List<ModelField> fields=new ArrayList<ModelField>();
  try {
    final BeanInfo beanInfo=Introspector.getBeanInfo(clazz);
    for (    PropertyDescriptor property : beanInfo.getPropertyDescriptors()) {
      if (shouldAddField(property)) {
        final String name=property.getName();
        if (name.equals("String_Node_Str")) {
          continue;
        }
        final ModelField field=new ModelField(property,validatorScanner.getValidators(property));
        fields.add(field);
      }
    }
  }
 catch (  IntrospectionException e) {
    LOG.error("String_Node_Str",e);
    throw new IllegalArgumentException("String_Node_Str",e);
  }
  return fields;
}

Fixed version (ground truth):
/** 
 * Scans the given class for model fields. Accesses bean properties (getter methods).
 * @param clazz Class to scan
 * @return List of model fields. Empty list if nothing found.
 * @throws CannotAccessDefaultConstructorError If the default constructor exists but cannot be accessed
 * @throws DefaultConstructorMissingError If the given model does not have a default constructor
 */
private List<ModelField> getFieldsByGetters(Class clazz){
  List<ModelField> fields=new ArrayList<ModelField>();
  try {
    final BeanInfo beanInfo=Introspector.getBeanInfo(clazz,Introspector.USE_ALL_BEANINFO);
    for (    PropertyDescriptor property : beanInfo.getPropertyDescriptors()) {
      if (shouldAddField(property)) {
        final String name=property.getName();
        if (name.equals("String_Node_Str")) {
          continue;
        }
        final ModelField field=new ModelField(property,validatorScanner.getValidators(property));
        fields.add(field);
      }
    }
  }
 catch (  IntrospectionException e) {
    LOG.error("String_Node_Str",e);
    throw new IllegalArgumentException("String_Node_Str",e);
  }
  return fields;
}
Program: 88942
Project: 88942
Buggy source:
@Test public void testStaticFinalMember(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  List<ModelField> models=fs.getFields(TestClassWithStaticMember.class);
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testStaticFinalMember(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  List<ModelField> models=fs.getFields(TestClassWithStaticFinalMember.class);
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
}
Program: 88943
Project: 88943
Buggy source:
@Test public void testGetterAnnotation(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.BEAN_PROPERTY);
  List<ModelField> models=fs.getFields(SimpleTestGetterClass.class);
  int i=assertFieldFound(models,"String_Node_Str");
  assertEquals(1,models.get(i).getValidators().size());
}

Fixed version (ground truth):
@Test public void testGetterAnnotation(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.BEAN_PROPERTY);
  List<ModelField> models=fs.getFields(SimpleTestGetterClass.class);
  int i=assertFieldFoundOnce(models,"String_Node_Str");
  assertEquals(1,models.get(i).getValidators().size());
}
Program: 88944
Project: 88944
Buggy source:
@Test public void testAllowFinalMember(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  fs.setAllowFinalFields(true);
  List<ModelField> models=fs.getFields(TestClassWithStaticMember.class);
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testAllowFinalMember(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  fs.setAllowFinalFields(true);
  List<ModelField> models=fs.getFields(TestClassWithStaticMember.class);
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
}
Program: 88945
Project: 88945
Buggy source:
@Test public void testIgnoreField(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  List<ModelField> models=fs.getFields(SimpleIgnoreTestClass.class);
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testIgnoreField(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  List<ModelField> models=fs.getFields(SimpleIgnoreTestClass.class);
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
}
Program: 88946
Project: 88946
Buggy source:
@Test public void testBeanExtraOptionsAllowAll(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.BEAN_PROPERTY);
  fs.setAllowFinalFields(true);
  fs.setAllowStaticFields(true);
  List<ModelField> models=fs.getFields(BeanWithStaticAndFinalProperties.class);
  assertFieldFound(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testBeanExtraOptionsAllowAll(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.BEAN_PROPERTY);
  fs.setAllowFinalFields(true);
  fs.setAllowStaticFields(true);
  List<ModelField> models=fs.getFields(BeanWithStaticAndFinalProperties.class);
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
}
Program: 88947
Project: 88947
Buggy source:
@Test public void testBeanVisibility(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.BEAN_PROPERTY);
  List<ModelField> models=fs.getFields(VisibilityTestGetterClass.class);
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testBeanVisibility(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.BEAN_PROPERTY);
  List<ModelField> models=fs.getFields(VisibilityTestGetterClass.class);
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
}
Program: 88948
Project: 88948
Buggy source:
@Test public void testAllowStaticFinalMember(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  fs.setAllowFinalFields(true);
  fs.setAllowStaticFields(true);
  List<ModelField> models=fs.getFields(TestClassWithStaticMember.class);
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testAllowStaticFinalMember(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  fs.setAllowFinalFields(true);
  fs.setAllowStaticFields(true);
  List<ModelField> models=fs.getFields(TestClassWithStaticMember.class);
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
}
Program: 88949
Project: 88949
Buggy source:
@Test public void testAllowStaticMember(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  fs.setAllowFinalFields(false);
  fs.setAllowStaticFields(true);
  List<ModelField> models=fs.getFields(TestClassWithStaticMember.class);
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testAllowStaticMember(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  fs.setAllowFinalFields(false);
  fs.setAllowStaticFields(true);
  List<ModelField> models=fs.getFields(TestClassWithStaticMember.class);
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
}
Program: 88950
Project: 88950
Buggy source:
@Test public void testDontAllowFinalMember(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  fs.setAllowFinalFields(false);
  List<ModelField> models=fs.getFields(TestClassWithStaticMember.class);
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testDontAllowFinalMember(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  fs.setAllowFinalFields(false);
  List<ModelField> models=fs.getFields(TestClassWithStaticMember.class);
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
}
Program: 88951
Project: 88951
Buggy source:
@Test public void testFieldWithValidation(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  List<ModelField> models=fs.getFields(TestClassWithValidation.class);
  assertFieldFound(models,"String_Node_Str");
  int fieldIndexWithAnnotations=assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  ModelField fieldWithAnnotations=models.get(fieldIndexWithAnnotations);
  assertEquals(1,fieldWithAnnotations.getValidators().size());
}

Fixed version (ground truth):
@Test public void testFieldWithValidation(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  List<ModelField> models=fs.getFields(TestClassWithValidation.class);
  assertFieldFoundOnce(models,"String_Node_Str");
  int fieldIndexWithAnnotations=assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  ModelField fieldWithAnnotations=models.get(fieldIndexWithAnnotations);
  assertEquals(1,fieldWithAnnotations.getValidators().size());
}
Program: 88952
Project: 88952
Buggy source:
@Test public void testIgnoreBeanProperty(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.BEAN_PROPERTY);
  List<ModelField> models=fs.getFields(IgnoreBeanPropertyClass.class);
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testIgnoreBeanProperty(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.BEAN_PROPERTY);
  List<ModelField> models=fs.getFields(IgnoreBeanPropertyClass.class);
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
}
Program: 88953
Project: 88953
Buggy source:
@Test public void testStaticAndFinalMember(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  List<ModelField> models=fs.getFields(TestClassWithStaticMember.class);
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testStaticAndFinalMember(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  List<ModelField> models=fs.getFields(TestClassWithStaticMember.class);
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
}
Program: 88954
Project: 88954
Buggy source:
@Test public void testGetFields(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  List<ModelField> models=fs.getFields(SimpleTestClass.class);
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testGetFields(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.DIRECT_FIELD_ACCESS);
  List<ModelField> models=fs.getFields(SimpleTestClass.class);
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
}
Program: 88955
Project: 88955
Buggy source:
@Test public void testBeanExtraOptionsDefault(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.BEAN_PROPERTY);
  List<ModelField> models=fs.getFields(BeanWithStaticAndFinalProperties.class);
  assertFieldFound(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldFound(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testBeanExtraOptionsDefault(){
  DefaultModelFieldFactory fs=getFieldScanner(FieldScanMode.BEAN_PROPERTY);
  List<ModelField> models=fs.getFields(BeanWithStaticAndFinalProperties.class);
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
  assertFieldFoundOnce(models,"String_Node_Str");
  assertFieldNotFound(models,"String_Node_Str");
}
Program: 88956
Project: 88956
Buggy source:
/** 
 * Converts the given value using a suitable converter class
 * @param value Value to convert
 * @param clazz Value's class
 * @return Converted value depending on settings
 */
private String convertByClass(Object value,Class clazz){
  ValueConverter converter=getConverterByClass(clazz);
  if (converter == null) {
    LOG.debug(value.getClass().getCanonicalName());
  }
  return converter.convertValue(value);
}

Fixed version (ground truth):
/** 
 * Converts the given value using a suitable converter class
 * @param value Value to convert
 * @param clazz Value's class
 * @return Converted value depending on settings
 */
private String convertByClass(Object value,Class clazz){
  ValueConverter converter=getConverterByClass(clazz);
  if (converter == null) {
    LOG.debug(value.getClass().getCanonicalName());
    return nullValue;
  }
  return converter.convertValue(value);
}