nus-yam/ex-repair huggingface dataset:
Program: 31686
Project: 31686
Buggy source:
/** 
 * Given an set of names (simple or fully-qualified) that are possibly within a type hierarchy, this function returns the base class from among them.
 * @param taxa the taxa (simple class names or labels)
 * @return The ClassInfo representing the base class among the taxa or <code>null</code> if it cannot be found
 */
public ClassInfo resolve(String... taxa){
  if (taxa.length > 0) {
    Set<ClassInfo> resolved=new HashSet<>();
    for (    String taxon : taxa) {
      ClassInfo taxonClassInfo=classInfo(taxon);
      if (taxonClassInfo == null) {
        continue;
      }
      if (taxonClassInfo.isInterface()) {
        taxonClassInfo=findSingleImplementor(taxon);
      }
 else       if (taxonClassInfo.isAbstract()) {
        taxonClassInfo=findSingleBaseClass(taxonClassInfo,taxonClassInfo.directSubclasses());
      }
      if (taxonClassInfo != null) {
        List<ClassInfo> taxonClassInfoSubclasses=taxonClassInfo.directSubclasses();
        for (        ClassInfo found : resolved) {
          if (found.directSubclasses().contains(taxonClassInfo)) {
            resolved.remove(found);
            break;
          }
          if (taxonClassInfoSubclasses.contains(found)) {
            taxonClassInfo=null;
            break;
          }
        }
      }
      if (taxonClassInfo != null) {
        resolved.add(taxonClassInfo);
      }
    }
    if (resolved.size() > 1) {
      throw new AmbiguousBaseClassException(Arrays.toString(taxa));
    }
    if (resolved.iterator().hasNext()) {
      return resolved.iterator().next();
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Given an set of names (simple or fully-qualified) that are possibly within a type hierarchy, this function returns the base class from among them.
 * @param taxa the taxa (simple class names or labels)
 * @return The ClassInfo representing the base class among the taxa or <code>null</code> if it cannot be found
 */
public ClassInfo resolve(String... taxa){
  if (taxa.length > 0) {
    Set<ClassInfo> resolved=new HashSet<>();
    for (    String taxon : taxa) {
      ClassInfo taxonClassInfo=classInfo(taxon);
      if (taxonClassInfo == null) {
        continue;
      }
      if (taxonClassInfo.isInterface()) {
        taxonClassInfo=findSingleImplementor(taxon);
      }
 else       if (taxonClassInfo.isAbstract()) {
        taxonClassInfo=findFirstSingleConcreteClass(taxonClassInfo,taxonClassInfo.directSubclasses());
      }
      if (taxonClassInfo != null) {
        for (        ClassInfo found : resolved) {
          if (taxonClassInfo.isSubclassOf(found)) {
            resolved.remove(found);
            break;
          }
          if (found.isSubclassOf(taxonClassInfo)) {
            taxonClassInfo=null;
            break;
          }
        }
      }
      if (taxonClassInfo != null) {
        resolved.add(taxonClassInfo);
      }
    }
    if (resolved.size() > 1) {
      throw new AmbiguousBaseClassException(Arrays.toString(taxa));
    }
    if (resolved.iterator().hasNext()) {
      return resolved.iterator().next();
    }
  }
  return null;
}
Program: 31687
Project: 31687
Buggy source:
/** 
 * @see issue #40
 */
@Test @Ignore public void shouldBeAbleToSaveAndLoadDogsDirectly(){
  Dog dog=new Dog("String_Node_Str");
  session.save(dog);
  session.clear();
  Dog snoopy=session.loadAll(Dog.class).iterator().next();
  assertNotNull(snoopy);
  assertEquals(dog.getName(),snoopy.getName());
}

Fixed version (ground truth):
/** 
 * @see issue #40
 */
@Test public void shouldBeAbleToSaveAndLoadDogsDirectly(){
  Dog dog=new Dog("String_Node_Str");
  session.save(dog);
  session.clear();
  Dog snoopy=session.loadAll(Dog.class).iterator().next();
  assertNotNull(snoopy);
  assertEquals(dog.getName(),snoopy.getName());
}
Program: 31688
Project: 31688
Buggy source:
/** 
 * @see issue #40
 */
@Test @Ignore public void shouldResolveMetadataCorrectly(){
  MetaData metaData=new MetaData("String_Node_Str");
  assertEquals("String_Node_Str",metaData.resolve("String_Node_Str").name());
  assertEquals("String_Node_Str",metaData.resolve("String_Node_Str","String_Node_Str").name());
  assertEquals("String_Node_Str",metaData.resolve("String_Node_Str","String_Node_Str","String_Node_Str").name());
  assertEquals("String_Node_Str",metaData.resolve("String_Node_Str","String_Node_Str","String_Node_Str").name());
}

Fixed version (ground truth):
/** 
 * @see issue #40
 */
@Test public void shouldResolveMetadataCorrectly(){
  MetaData metaData=new MetaData("String_Node_Str");
  assertEquals("String_Node_Str",metaData.resolve("String_Node_Str").name());
  assertEquals("String_Node_Str",metaData.resolve("String_Node_Str","String_Node_Str").name());
  assertEquals("String_Node_Str",metaData.resolve("String_Node_Str","String_Node_Str","String_Node_Str").name());
  assertEquals("String_Node_Str",metaData.resolve("String_Node_Str","String_Node_Str","String_Node_Str").name());
}
Program: 31689
Project: 31689
Buggy source:
/** 
 * @see issue #40
 */
@Test @Ignore public void shouldBeAbleToSaveAndLoadDomesticDogsDirectly(){
  DomesticDog dog=new DomesticDog("String_Node_Str");
  session.save(dog);
  session.clear();
  DomesticDog snoopy=session.loadAll(DomesticDog.class).iterator().next();
  assertNotNull(snoopy);
  assertEquals(dog.getName(),snoopy.getName());
}

Fixed version (ground truth):
/** 
 * @see issue #40
 */
@Test public void shouldBeAbleToSaveAndLoadDomesticDogsDirectly(){
  DomesticDog dog=new DomesticDog("String_Node_Str");
  session.save(dog);
  session.clear();
  DomesticDog snoopy=session.loadAll(DomesticDog.class).iterator().next();
  assertNotNull(snoopy);
  assertEquals(dog.getName(),snoopy.getName());
}
Program: 31691
Project: 31691
Buggy source:
public boolean isTypeOf(Class<?> type){
  while (type != null) {
    String typeSignature="String_Node_Str" + type.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
    if (descriptor != null && descriptor.equals(typeSignature)) {
      return true;
    }
    type=type.getSuperclass();
  }
  return false;
}

Fixed version (ground truth):
public boolean isTypeOf(Class<?> type){
  while (type != null) {
    String typeSignature="String_Node_Str" + type.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
    if (descriptor != null && descriptor.equals(typeSignature)) {
      return true;
    }
    for (    Class<?> iface : type.getInterfaces()) {
      typeSignature="String_Node_Str" + iface.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
      if (descriptor != null && descriptor.equals(typeSignature)) {
        return true;
      }
    }
    type=type.getSuperclass();
  }
  return false;
}
Program: 31692
Project: 31692
Buggy source:
public boolean isParameterisedTypeOf(Class<?> type){
  while (type != null) {
    String typeSignature="String_Node_Str" + type.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
    if (typeParameterDescriptor != null && typeParameterDescriptor.equals(typeSignature)) {
      return true;
    }
    type=type.getSuperclass();
  }
  return false;
}

Fixed version (ground truth):
public boolean isParameterisedTypeOf(Class<?> type){
  while (type != null) {
    String typeSignature="String_Node_Str" + type.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
    if (typeParameterDescriptor != null && typeParameterDescriptor.equals(typeSignature)) {
      return true;
    }
    for (    Class<?> iface : type.getInterfaces()) {
      typeSignature="String_Node_Str" + iface.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
      if (typeParameterDescriptor != null && typeParameterDescriptor.equals(typeSignature)) {
        return true;
      }
    }
    type=type.getSuperclass();
  }
  return false;
}
Program: 31693
Project: 31693
Buggy source:
public boolean isArrayOf(Class<?> type){
  while (type != null) {
    String typeSignature="String_Node_Str" + type.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
    if (descriptor != null && descriptor.equals(typeSignature)) {
      return true;
    }
    type=type.getSuperclass();
  }
  return false;
}

Fixed version (ground truth):
public boolean isArrayOf(Class<?> type){
  while (type != null) {
    String typeSignature="String_Node_Str" + type.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
    if (descriptor != null && descriptor.equals(typeSignature)) {
      return true;
    }
    for (    Class<?> iface : type.getInterfaces()) {
      typeSignature="String_Node_Str" + iface.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
      if (descriptor != null && descriptor.equals(typeSignature)) {
        return true;
      }
    }
    type=type.getSuperclass();
  }
  return false;
}
Program: 31694
Project: 31694
Buggy source:
public boolean isTypeOf(Class<?> type){
  while (type != null) {
    String typeSignature="String_Node_Str" + type.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
    if (descriptor != null && descriptor.equals(typeSignature)) {
      return true;
    }
    type=type.getSuperclass();
  }
  return false;
}

Fixed version (ground truth):
public boolean isTypeOf(Class<?> type){
  while (type != null) {
    String typeSignature="String_Node_Str" + type.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
    if (descriptor != null && descriptor.equals(typeSignature)) {
      return true;
    }
    for (    Class<?> iface : type.getInterfaces()) {
      typeSignature="String_Node_Str" + iface.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
      if (descriptor != null && descriptor.equals(typeSignature)) {
        return true;
      }
    }
    type=type.getSuperclass();
  }
  return false;
}
Program: 31695
Project: 31695
Buggy source:
public boolean isParameterisedTypeOf(Class<?> type){
  while (type != null) {
    String typeSignature="String_Node_Str" + type.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
    if (typeParameterDescriptor != null && typeParameterDescriptor.equals(typeSignature)) {
      return true;
    }
    type=type.getSuperclass();
  }
  return false;
}

Fixed version (ground truth):
public boolean isParameterisedTypeOf(Class<?> type){
  while (type != null) {
    String typeSignature="String_Node_Str" + type.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
    if (typeParameterDescriptor != null && typeParameterDescriptor.equals(typeSignature)) {
      return true;
    }
    for (    Class<?> iface : type.getInterfaces()) {
      typeSignature="String_Node_Str" + iface.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
      if (typeParameterDescriptor != null && typeParameterDescriptor.equals(typeSignature)) {
        return true;
      }
    }
    type=type.getSuperclass();
  }
  return false;
}
Program: 31696
Project: 31696
Buggy source:
public boolean isArrayOf(Class<?> type){
  while (type != null) {
    String typeSignature="String_Node_Str" + type.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
    if (descriptor != null && descriptor.equals(typeSignature)) {
      return true;
    }
    type=type.getSuperclass();
  }
  return false;
}

Fixed version (ground truth):
public boolean isArrayOf(Class<?> type){
  while (type != null) {
    String typeSignature="String_Node_Str" + type.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
    if (descriptor != null && descriptor.equals(typeSignature)) {
      return true;
    }
    for (    Class<?> iface : type.getInterfaces()) {
      typeSignature="String_Node_Str" + iface.getName().replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
      if (descriptor != null && descriptor.equals(typeSignature)) {
        return true;
      }
    }
    type=type.getSuperclass();
  }
  return false;
}
Program: 31697
Project: 31697
Buggy source:
private void scanZipFile(final ZipFile zipFile) throws IOException {
  LOGGER.debug("String_Node_Str" + zipFile.getName());
  for (Enumeration<? extends ZipEntry> entries=zipFile.entries(); entries.hasMoreElements(); ) {
    final ZipEntry entry=entries.nextElement();
    scanZipEntry(entry,zipFile,null);
  }
}

Fixed version (ground truth):
private void scanZipFile(final ZipFile zipFile) throws IOException {
  LOGGER.debug("String_Node_Str" + zipFile.getName());
  String path=null;
  for (Enumeration<? extends ZipEntry> entries=zipFile.entries(); entries.hasMoreElements(); ) {
    final ZipEntry entry=entries.nextElement();
    if (entry.isDirectory()) {
      path=entry.getName();
    }
 else {
      scanZipEntry(path,entry,zipFile,null);
    }
  }
}
Program: 31698
Project: 31698
Buggy source:
private void scanZipEntry(ZipEntry zipEntry,ZipFile zipFile,ZipInputStream zipInputStream) throws IOException {
  LOGGER.debug("String_Node_Str" + zipEntry.getName());
  if (!zipEntry.isDirectory()) {
    String path=zipEntry.getName();
    if (path.endsWith("String_Node_Str") || path.endsWith("String_Node_Str")) {
      InputStream inputStream=zipFile.getInputStream(zipEntry);
      if (inputStream != null) {
        zipInputStream=new ZipInputStream(inputStream);
      }
 else {
        LOGGER.info("String_Node_Str" + zipEntry.getName());
      }
      ZipEntry entry=zipInputStream.getNextEntry();
      while (entry != null) {
        scanZipEntry(entry,zipFile,zipInputStream);
        entry=zipInputStream.getNextEntry();
      }
    }
    boolean scanFile=false;
    for (    String pathToScan : classPaths) {
      if (path.startsWith(pathToScan)) {
        scanFile=true;
        break;
      }
    }
    if (scanFile && path.endsWith("String_Node_Str")) {
      if (zipInputStream == null) {
        try (InputStream inputStream=zipFile.getInputStream(zipEntry)){
          processor.process(inputStream);
        }
       }
 else {
        processor.process(zipInputStream);
        zipInputStream.closeEntry();
      }
    }
  }
}

Fixed version (ground truth):
private void scanZipEntry(String path,ZipEntry zipEntry,ZipFile zipFile,ZipInputStream zipInputStream) throws IOException {
  String zipEntryName=zipEntry.getName();
  LOGGER.debug("String_Node_Str" + zipEntryName);
  if (zipEntryName.endsWith("String_Node_Str") || zipEntryName.endsWith("String_Node_Str")) {
    InputStream inputStream=zipFile.getInputStream(zipEntry);
    if (inputStream != null) {
      zipInputStream=new ZipInputStream(inputStream);
    }
 else {
      LOGGER.info("String_Node_Str" + zipEntry.getName());
    }
    ZipEntry entry=zipInputStream.getNextEntry();
    String nestedPath=null;
    while (entry != null) {
      if (entry.isDirectory()) {
        nestedPath=entry.getName();
      }
 else {
        scanZipEntry(nestedPath,entry,zipFile,zipInputStream);
      }
      entry=zipInputStream.getNextEntry();
    }
  }
  boolean scanFile=false;
  for (  String pathToScan : classPaths) {
    if (path.startsWith(pathToScan)) {
      scanFile=true;
      break;
    }
  }
  if (scanFile && zipEntryName.endsWith("String_Node_Str")) {
    if (zipInputStream == null) {
      try (InputStream inputStream=zipFile.getInputStream(zipEntry)){
        processor.process(inputStream);
      }
     }
 else {
      processor.process(zipInputStream);
      zipInputStream.closeEntry();
    }
  }
}
Program: 31699
Project: 31699
Buggy source:
@Test @Ignore public void zipFileWithDomainClassesShouldBeScanned() throws IOException {
  ClassPathScanner classPathScanner=new FileClassPathScanner();
  ClassScanProcessor processor=new ClassScanProcessor();
  classPathScanner.scan(Collections.singletonList("String_Node_Str"),processor);
  assertEquals(2,processor.domainClassInfos.size());
  List<String> classNames=extractClassNames(processor.domainClassInfos);
  assertTrue(classNames.contains("String_Node_Str"));
  assertTrue(classNames.contains("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void zipFileWithDomainClassesShouldBeScanned() throws IOException {
  ClassPathScanner classPathScanner=new FileClassPathScanner();
  ClassScanProcessor processor=new ClassScanProcessor();
  classPathScanner.scan(Collections.singletonList("String_Node_Str"),processor);
  assertEquals(2,processor.domainClassInfos.size());
  List<String> classNames=extractClassNames(processor.domainClassInfos);
  assertTrue(classNames.contains("String_Node_Str"));
  assertTrue(classNames.contains("String_Node_Str"));
}
Program: 31700
Project: 31700
Buggy source:
@Test @Ignore public void domainClassesInNestedZipShouldBeScanned(){
  ClassPathScanner classPathScanner=new FileClassPathScanner();
  ClassScanProcessor processor=new ClassScanProcessor();
  classPathScanner.scan(Collections.singletonList("String_Node_Str"),processor);
  assertEquals(2,processor.domainClassInfos.size());
  List<String> classNames=extractClassNames(processor.domainClassInfos);
  assertTrue(classNames.contains("String_Node_Str"));
  assertTrue(classNames.contains("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void domainClassesInNestedZipShouldBeScanned(){
  ClassPathScanner classPathScanner=new FileClassPathScanner();
  ClassScanProcessor processor=new ClassScanProcessor();
  classPathScanner.scan(Collections.singletonList("String_Node_Str"),processor);
  assertEquals(2,processor.domainClassInfos.size());
  List<String> classNames=extractClassNames(processor.domainClassInfos);
  assertTrue(classNames.contains("String_Node_Str"));
  assertTrue(classNames.contains("String_Node_Str"));
}
Program: 31701
Project: 31701
Buggy source:
@Test @Ignore public void domainClassesInDirectoryInNestedZipShouldBeScanned(){
  ClassPathScanner classPathScanner=new FileClassPathScanner();
  ClassScanProcessor processor=new ClassScanProcessor();
  classPathScanner.scan(Collections.singletonList("String_Node_Str"),processor);
  assertEquals(1,processor.domainClassInfos.size());
  List<String> classNames=extractClassNames(processor.domainClassInfos);
  assertTrue(classNames.contains("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void domainClassesInDirectoryInNestedZipShouldBeScanned(){
  ClassPathScanner classPathScanner=new FileClassPathScanner();
  ClassScanProcessor processor=new ClassScanProcessor();
  classPathScanner.scan(Collections.singletonList("String_Node_Str"),processor);
  assertEquals(1,processor.domainClassInfos.size());
  List<String> classNames=extractClassNames(processor.domainClassInfos);
  assertTrue(classNames.contains("String_Node_Str"));
}
Program: 31704
Project: 31704
Buggy source:
/** 
 * @see DATAGRAPH-690
 */
@Test @Ignore public void shouldKeepAllRelations(){
  Category category=new Category("String_Node_Str");
  Tag tag1=new Tag("String_Node_Str");
  Set<Tag> tags=new HashSet<>();
  tags.add(tag1);
  Event event=new Event("String_Node_Str");
  event.setCategory(category);
  event.setTags(tags);
  session.save(event);
  assertNotNull(event.getNodeId());
  assertNotNull(category.getNodeId());
  assertNotNull(tag1.getNodeId());
  session.clear();
  Collection<Tag> tagsFound=session.loadAll(Tag.class,new Filter("String_Node_Str","String_Node_Str"));
  assertEquals(1,tagsFound.size());
  event.setTags(new HashSet<>(tagsFound));
  Collection<Category> categoriesFound=session.loadAll(Category.class,new Filter("String_Node_Str","String_Node_Str"));
  assertEquals(1,categoriesFound.size());
  event.setCategory(categoriesFound.iterator().next());
  assertEquals(tag1,event.getTags().iterator().next());
  assertEquals(category,event.getCategory());
  session.save(event);
  session.clear();
  Event eventFound=session.load(Event.class,event.getNodeId(),1);
  assertNotNull(eventFound.getNodeId());
  assertEquals(category,eventFound.getCategory());
  assertEquals(tags,eventFound.getTags());
}

Fixed version (ground truth):
/** 
 * @see DATAGRAPH-690
 */
@Test @Ignore public void shouldKeepAllRelations(){
  Category category=new Category("String_Node_Str");
  Tag tag1=new Tag("String_Node_Str");
  Set<Tag> tags=new HashSet<>();
  tags.add(tag1);
  Event event=new Event("String_Node_Str");
  event.setCategory(category);
  event.setTags(tags);
  session.save(event);
  assertNotNull(event.getNodeId());
  assertNotNull(category.getNodeId());
  assertNotNull(tag1.getNodeId());
  session.clear();
  Collection<Tag> tagsFound=session.loadAll(Tag.class,new Filter("String_Node_Str","String_Node_Str"));
  assertEquals(1,tagsFound.size());
  event.setTags(new HashSet<>(tagsFound));
  Collection<Category> categoriesFound=session.loadAll(Category.class,new Filter("String_Node_Str","String_Node_Str"));
  assertEquals(1,categoriesFound.size());
  event.setCategory(categoriesFound.iterator().next());
  assertEquals(tag1,event.getTags().iterator().next());
  assertEquals(category,event.getCategory());
  session.save(event);
  session.clear();
  Event eventFound=session.load(Event.class,event.getNodeId(),1);
  assertNotNull(eventFound.getNodeId());
  assertEquals(category,eventFound.getCategory());
  assertEquals(tag1,eventFound.getTags().iterator().next());
}
Program: 31705
Project: 31705
Buggy source:
@Test public void shouldFetchFriendsUndirected(){
  User adam=new User("String_Node_Str");
  User daniela=new User("String_Node_Str");
  User michal=new User("String_Node_Str");
  User vince=new User("String_Node_Str");
  adam.befriend(daniela);
  daniela.befriend(michal);
  michal.befriend(vince);
  session.save(adam);
  session.clear();
  daniela=session.load(User.class,daniela.getId());
  assertEquals(2,daniela.getFriends().size());
  List<String> friendNames=new ArrayList<>();
  for (  User friend : daniela.getFriends()) {
    friendNames.add(friend.getName());
  }
  assertTrue(friendNames.contains("String_Node_Str"));
  assertTrue(friendNames.contains("String_Node_Str"));
  session.clear();
  michal=session.load(User.class,michal.getId());
  assertEquals(2,michal.getFriends().size());
  session.clear();
  vince=session.load(User.class,vince.getId());
  assertEquals(1,vince.getFriends().size());
  session.clear();
  adam=session.load(User.class,adam.getId());
  assertEquals(1,adam.getFriends().size());
}

Fixed version (ground truth):
@Test public void shouldFetchFriendsUndirected(){
  User adam=new User("String_Node_Str");
  User daniela=new User("String_Node_Str");
  User michal=new User("String_Node_Str");
  User vince=new User("String_Node_Str");
  adam.befriend(daniela);
  daniela.befriend(michal);
  michal.befriend(vince);
  session.save(adam);
  session.clear();
  adam=session.load(User.class,adam.getId());
  assertEquals(1,adam.getFriends().size());
  daniela=session.load(User.class,daniela.getId());
  assertEquals(2,daniela.getFriends().size());
  List<String> friendNames=new ArrayList<>();
  for (  User friend : daniela.getFriends()) {
    friendNames.add(friend.getName());
  }
  assertTrue(friendNames.contains("String_Node_Str"));
  assertTrue(friendNames.contains("String_Node_Str"));
  session.clear();
  michal=session.load(User.class,michal.getId());
  assertEquals(2,michal.getFriends().size());
  session.clear();
  vince=session.load(User.class,vince.getId());
  assertEquals(1,vince.getFriends().size());
}
Program: 31707
Project: 31707
Buggy source:
@Test public void shouldBeAbleToRemoveContainedRelationshipOnly(){
  Folder folder=new Folder();
  Document doc1=new Document();
  folder.getDocuments().add(doc1);
  folder.getArchived().add(doc1);
  doc1.setFolder(folder);
  folder.setId(0L);
  doc1.setId(1L);
  mappingContext.registerNodeEntity(folder,folder.getId());
  mappingContext.registerNodeEntity(doc1,doc1.getId());
  mappingContext.registerRelationship(new MappedRelationship(folder.getId(),"String_Node_Str",doc1.getId()));
  mappingContext.registerRelationship(new MappedRelationship(folder.getId(),"String_Node_Str",doc1.getId()));
  mappingContext.remember(doc1);
  mappingContext.remember(folder);
  folder.getDocuments().remove(doc1);
  assertEquals(0,folder.getDocuments().size());
  assertEquals(1,folder.getArchived().size());
  expectOnSave(folder,"String_Node_Str","String_Node_Str");
  expectOnSave(doc1,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void shouldBeAbleToRemoveContainedRelationshipOnly(){
  Folder folder=new Folder();
  Document doc1=new Document();
  folder.getDocuments().add(doc1);
  folder.getArchived().add(doc1);
  doc1.setFolder(folder);
  folder.setId(0L);
  doc1.setId(1L);
  mappingContext.registerNodeEntity(folder,folder.getId());
  mappingContext.registerNodeEntity(doc1,doc1.getId());
  mappingContext.registerRelationship(new MappedRelationship(folder.getId(),"String_Node_Str",doc1.getId()));
  mappingContext.registerRelationship(new MappedRelationship(folder.getId(),"String_Node_Str",doc1.getId()));
  mappingContext.remember(doc1);
  mappingContext.remember(folder);
  folder.getDocuments().remove(doc1);
  doc1.setFolder(null);
  assertEquals(0,folder.getDocuments().size());
  assertEquals(1,folder.getArchived().size());
  expectOnSave(folder,"String_Node_Str","String_Node_Str");
  expectOnSave(doc1,"String_Node_Str");
}
Program: 31709
Project: 31709
Buggy source:
public void setEntities(Set<Entity> entities){
  this.entities=entities;
}

Fixed version (ground truth):
@Relationship(type="String_Node_Str",direction=Relationship.INCOMING) public void setEntities(Set<Entity> entities){
  this.entities=entities;
}
Program: 31710
Project: 31710
Buggy source:
public Set<Entity> getEntities(){
  return entities;
}

Fixed version (ground truth):
@Relationship(type="String_Node_Str",direction=Relationship.INCOMING) public Set<Entity> getEntities(){
  return entities;
}
Program: 31711
Project: 31711
Buggy source:
@Before public void init() throws IOException {
  TestServer testServer=new TestServer();
  session=new SessionFactory("String_Node_Str").openSession(testServer.url());
}

Fixed version (ground truth):
@Before public void init() throws IOException {
  session=new SessionFactory("String_Node_Str").openSession(neo4jRule.url());
}
Program: 31712
Project: 31712
Buggy source:
/** 
 * @see DATAGRAPH-690
 */
@Test public void mappingShouldConsiderClasses(){
  Category category=new Category("String_Node_Str");
  Tag tag1=new Tag("String_Node_Str");
  Set<Tag> tags=new HashSet<>();
  tags.add(tag1);
  Event event=new Event("String_Node_Str");
  event.setCategory(category);
  event.setTags(tags);
  session.save(event);
  assertNotNull(event.getNodeId());
  assertNotNull(event.getCategory().getNodeId());
  assertNotNull(event.getTags().iterator().next().getNodeId());
  session.clear();
  event=session.load(Event.class,event.getNodeId(),1);
  assertNotNull(event.getNodeId());
  assertEquals(category,event.getCategory());
  assertEquals(tags,event.getTags());
}

Fixed version (ground truth):
/** 
 * @see DATAGRAPH-636
 */
@Test public void mappingShouldConsiderClasses(){
  Category category=new Category("String_Node_Str");
  Tag tag1=new Tag("String_Node_Str");
  Set<Tag> tags=new HashSet<>();
  tags.add(tag1);
  Event event=new Event("String_Node_Str");
  event.setCategory(category);
  event.setTags(tags);
  session.save(event);
  assertNotNull(event.getNodeId());
  assertNotNull(event.getCategory().getNodeId());
  assertNotNull(event.getTags().iterator().next().getNodeId());
  session.clear();
  event=session.load(Event.class,event.getNodeId(),1);
  assertNotNull(event);
  assertEquals(category,event.getCategory());
  assertEquals(tag1,event.getTags().iterator().next());
}
Program: 31713
Project: 31713
Buggy source:
/** 
 * @see DATAGRAPH-690
 */
@Test public void shouldKeepAllRelations(){
  Category category=new Category("String_Node_Str");
  Tag tag1=new Tag("String_Node_Str");
  Set<Tag> tags=new HashSet<>();
  tags.add(tag1);
  Event event=new Event("String_Node_Str");
  event.setCategory(category);
  event.setTags(tags);
  session.save(event);
  assertNotNull(event.getNodeId());
  assertNotNull(category.getNodeId());
  assertNotNull(tag1.getNodeId());
  session.clear();
  Collection<Tag> tagsFound=session.loadAll(Tag.class,new Filter("String_Node_Str","String_Node_Str"));
  event.setTags(new HashSet<>(tagsFound));
  Collection<Category> categoriesFound=session.loadAll(Category.class,new Filter("String_Node_Str","String_Node_Str"));
  event.setCategory(categoriesFound.iterator().next());
  session.save(event);
  session.clear();
  Event eventFound=session.load(Event.class,event.getNodeId(),1);
  assertNotNull(eventFound.getNodeId());
  assertEquals(category,eventFound.getCategory());
  assertEquals(tags,eventFound.getTags());
}

Fixed version (ground truth):
/** 
 * @see DATAGRAPH-690
 */
@Test @Ignore public void shouldKeepAllRelations(){
  Category category=new Category("String_Node_Str");
  Tag tag1=new Tag("String_Node_Str");
  Set<Tag> tags=new HashSet<>();
  tags.add(tag1);
  Event event=new Event("String_Node_Str");
  event.setCategory(category);
  event.setTags(tags);
  session.save(event);
  assertNotNull(event.getNodeId());
  assertNotNull(category.getNodeId());
  assertNotNull(tag1.getNodeId());
  session.clear();
  Collection<Tag> tagsFound=session.loadAll(Tag.class,new Filter("String_Node_Str","String_Node_Str"));
  assertEquals(1,tagsFound.size());
  event.setTags(new HashSet<>(tagsFound));
  Collection<Category> categoriesFound=session.loadAll(Category.class,new Filter("String_Node_Str","String_Node_Str"));
  assertEquals(1,categoriesFound.size());
  event.setCategory(categoriesFound.iterator().next());
  assertEquals(tag1,event.getTags().iterator().next());
  assertEquals(category,event.getCategory());
  session.save(event);
  session.clear();
  Event eventFound=session.load(Event.class,event.getNodeId(),1);
  assertNotNull(eventFound.getNodeId());
  assertEquals(category,eventFound.getCategory());
  assertEquals(tags,eventFound.getTags());
}
Program: 31714
Project: 31714
Buggy source:
/** 
 * Returns an unused relationship's reference to the ref pool This is to ensure that references are only created when needed
 * @param relationshipBuilder
 */
void release(RelationshipBuilder relationshipBuilder);

Fixed version (ground truth):
/** 
 * Returns an unused relationship's reference to the ref pool This is to ensure that references are only created when needed
 * @param relationshipBuilder the {@link RelationshipBuilder}
 */
void release(RelationshipBuilder relationshipBuilder);
Program: 31717
Project: 31717
Buggy source:
/** 
 * Emits one or more Cypher clauses.
 * @param queryBuilder The {@code StringBuilder} to which the Cypher should be appended
 * @param parameters A {@link Map} to which Cypher parameter values may optionally be added as the query is built up
 * @param varStack The variable stack carried through the query, to which this emitter's variable name may be added
 */
boolean emit(StringBuilder queryBuilder,Map<String,Object> parameters,Set<String> varStack);

Fixed version (ground truth):
/** 
 * Emits one or more Cypher clauses.
 * @param queryBuilder The {@code StringBuilder} to which the Cypher should be appended
 * @param parameters A {@link Map} to which Cypher parameter values may optionally be added as the query is built up
 * @param varStack The variable stack carried through the query, to which this emitter's variable name may be added
 * @return true if a Cypher clause has been emitted, false otherwise
 */
boolean emit(StringBuilder queryBuilder,Map<String,Object> parameters,Set<String> varStack);
Program: 31718
Project: 31718
Buggy source:
/** 
 * Creates a MappedRelationship from a TransientRelationship using the supplied refMap to lookup and replace the correct start and end node ids
 * @param refMap A Map containing refs to the src/tgt ids
 * @return
 */
public MappedRelationship convert(Map<String,Long> refMap){
  Long srcIdentity=src.startsWith("String_Node_Str") ? refMap.get(src) : Long.parseLong(src.substring(1));
  Long tgtIdentity=tgt.startsWith("String_Node_Str") ? refMap.get(tgt) : Long.parseLong(tgt.substring(1));
  Long relIdentity=ref.startsWith("String_Node_Str") ? refMap.get(ref) : Long.parseLong(ref.substring(1));
  if (srcIdentity == null) {
    throw new RuntimeException("String_Node_Str" + src);
  }
  if (tgtIdentity == null) {
    throw new RuntimeException("String_Node_Str" + tgt);
  }
  if (relIdentity == null) {
    throw new RuntimeException("String_Node_Str" + ref);
  }
  return new MappedRelationship(srcIdentity,rel,tgtIdentity,relIdentity);
}

Fixed version (ground truth):
/** 
 * Creates a MappedRelationship from a TransientRelationship using the supplied refMap to lookup and replace the correct start and end node ids
 * @param refMap A Map containing refs to the src/tgt ids
 * @return the MappedRelationship
 */
public MappedRelationship convert(Map<String,Long> refMap){
  Long srcIdentity=src.startsWith("String_Node_Str") ? refMap.get(src) : Long.parseLong(src.substring(1));
  Long tgtIdentity=tgt.startsWith("String_Node_Str") ? refMap.get(tgt) : Long.parseLong(tgt.substring(1));
  Long relIdentity=ref.startsWith("String_Node_Str") ? refMap.get(ref) : Long.parseLong(ref.substring(1));
  if (srcIdentity == null) {
    throw new RuntimeException("String_Node_Str" + src);
  }
  if (tgtIdentity == null) {
    throw new RuntimeException("String_Node_Str" + tgt);
  }
  if (relIdentity == null) {
    throw new RuntimeException("String_Node_Str" + ref);
  }
  return new MappedRelationship(srcIdentity,rel,tgtIdentity,relIdentity);
}
Program: 31719
Project: 31719
Buggy source:
/** 
 * Get a list of unique elements on the classpath as File objects, preserving order. Classpath elements that do not exist are not returned.
 * @param classPaths classpaths to be included
 */
public static ArrayList<File> getUniqueClasspathElements(List<String> classPaths){
  ArrayList<File> pathFiles=new ArrayList<>();
  for (  String classPath : classPaths) {
    try {
      Enumeration<URL> resources=ClassUtils.class.getClassLoader().getResources(classPath.replace("String_Node_Str","String_Node_Str"));
      while (resources.hasMoreElements()) {
        URL resource=resources.nextElement();
        if (resource.getProtocol().equals("String_Node_Str")) {
          pathFiles.add(new File(resource.toURI()));
        }
 else         if (resource.getProtocol().equals("String_Node_Str")) {
          String jarPath=resource.getPath().substring(5,resource.getPath().indexOf("String_Node_Str"));
          pathFiles.add(new File(jarPath));
        }
      }
    }
 catch (    IOException|URISyntaxException e) {
      throw new RuntimeException(e);
    }
  }
  return pathFiles;
}

Fixed version (ground truth):
/** 
 * Get a list of unique elements on the classpath as File objects, preserving order. Classpath elements that do not exist are not returned.
 * @param classPaths classpaths to be included
 * @return {@link List} of unique {@link File} objects on the classpath
 */
public static ArrayList<File> getUniqueClasspathElements(List<String> classPaths){
  ArrayList<File> pathFiles=new ArrayList<>();
  for (  String classPath : classPaths) {
    try {
      Enumeration<URL> resources=ClassUtils.class.getClassLoader().getResources(classPath.replace("String_Node_Str","String_Node_Str"));
      while (resources.hasMoreElements()) {
        URL resource=resources.nextElement();
        if (resource.getProtocol().equals("String_Node_Str")) {
          pathFiles.add(new File(resource.toURI()));
        }
 else         if (resource.getProtocol().equals("String_Node_Str")) {
          String jarPath=resource.getPath().substring(5,resource.getPath().indexOf("String_Node_Str"));
          pathFiles.add(new File(jarPath));
        }
      }
    }
 catch (    IOException|URISyntaxException e) {
      throw new RuntimeException(e);
    }
  }
  return pathFiles;
}
Program: 31720
Project: 31720
Buggy source:
/** 
 * Return the reified class for the parameter of a parameterised setter or field from the parameter signature
 */
public static Class<?> getType(String descriptor){
  int p=descriptor.indexOf("String_Node_Str");
  int q=descriptor.indexOf("String_Node_Str");
  if (!descriptor.contains("String_Node_Str")) {
    if (descriptor.endsWith("String_Node_Str")) {
      q--;
    }
    if (descriptor.startsWith("String_Node_Str")) {
      p++;
    }
    if (descriptor.startsWith("String_Node_Str")) {
      p++;
      q=descriptor.length() - 1;
    }
  }
  if (descriptor.startsWith("String_Node_Str")) {
    p=0;
    q=2;
  }
  if (descriptor.startsWith("String_Node_Str")) {
    p=1;
    q=descriptor.length() - 1;
  }
  if (descriptor.length() == 1) {
    q=1;
  }
  String typeName=descriptor.substring(p + 1,q).replace("String_Node_Str","String_Node_Str");
  if (typeName.length() == 1) {
    return PRIMITIVE_TYPE_MAP.get(typeName);
  }
  try {
    return Class.forName(typeName);
  }
 catch (  ClassNotFoundException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Return the reified class for the parameter of a parameterised setter or field from the parameter signature
 * @param descriptor parameter descriptor
 * @return reified class for the parameter
 */
public static Class<?> getType(String descriptor){
  int p=descriptor.indexOf("String_Node_Str");
  int q=descriptor.indexOf("String_Node_Str");
  if (!descriptor.contains("String_Node_Str")) {
    if (descriptor.endsWith("String_Node_Str")) {
      q--;
    }
    if (descriptor.startsWith("String_Node_Str")) {
      p++;
    }
    if (descriptor.startsWith("String_Node_Str")) {
      p++;
      q=descriptor.length() - 1;
    }
  }
  if (descriptor.startsWith("String_Node_Str")) {
    p=0;
    q=2;
  }
  if (descriptor.startsWith("String_Node_Str")) {
    p=1;
    q=descriptor.length() - 1;
  }
  if (descriptor.length() == 1) {
    q=1;
  }
  String typeName=descriptor.substring(p + 1,q).replace("String_Node_Str","String_Node_Str");
  if (typeName.length() == 1) {
    return PRIMITIVE_TYPE_MAP.get(typeName);
  }
  try {
    return Class.forName(typeName);
  }
 catch (  ClassNotFoundException e) {
    throw new RuntimeException(e);
  }
}
Program: 31721
Project: 31721
Buggy source:
/** 
 * @param methodInfo
 * @param parameterTypes
 * @return
 */
public Method getMethod(MethodInfo methodInfo,Class... parameterTypes){
  try {
    return Class.forName(name()).getMethod(methodInfo.getName(),parameterTypes);
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public Method getMethod(MethodInfo methodInfo,Class... parameterTypes){
  try {
    return Class.forName(name()).getMethod(methodInfo.getName(),parameterTypes);
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 31722
Project: 31722
Buggy source:
/** 
 * Finds all fields whose type is equivalent to Array<X> or assignable from Iterable<X> where X is the generic parameter type of the Array or Iterable and the relationship type backing this iterable is "relationshipType"
 */
public List<FieldInfo> findIterableFields(Class iteratedType,String relationshipType){
  List<FieldInfo> fieldInfos=new ArrayList<>();
  for (  FieldInfo fieldInfo : findIterableFields(iteratedType)) {
    if (fieldInfo.relationship().equals(relationshipType)) {
      fieldInfos.add(fieldInfo);
    }
  }
  return fieldInfos;
}

Fixed version (ground truth):
/** 
 * Finds all fields whose type is equivalent to Array&lt;X&gt; or assignable from Iterable&lt;X&gt; where X is the generic parameter type of the Array or Iterable and the relationship type backing this iterable is "relationshipType"
 * @param iteratedType      the type of iterable
 * @param relationshipType  the relationship type
 * @return {@link List} of {@link MethodInfo}, never <code>null</code>
 */
public List<FieldInfo> findIterableFields(Class iteratedType,String relationshipType){
  List<FieldInfo> fieldInfos=new ArrayList<>();
  for (  FieldInfo fieldInfo : findIterableFields(iteratedType)) {
    if (fieldInfo.relationship().equals(relationshipType)) {
      fieldInfos.add(fieldInfo);
    }
  }
  return fieldInfos;
}
Program: 31723
Project: 31723
Buggy source:
/** 
 * @param fieldInfo
 * @return
 */
public Field getField(FieldInfo fieldInfo){
  try {
    return Class.forName(name()).getDeclaredField(fieldInfo.getName());
  }
 catch (  NoSuchFieldException e) {
    if (directSuperclass() != null) {
      return directSuperclass().getField(fieldInfo);
    }
 else {
      throw new RuntimeException("String_Node_Str" + fieldInfo.getName() + "String_Node_Str"+ name()+ "String_Node_Str");
    }
  }
catch (  ClassNotFoundException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public Field getField(FieldInfo fieldInfo){
  try {
    return Class.forName(name()).getDeclaredField(fieldInfo.getName());
  }
 catch (  NoSuchFieldException e) {
    if (directSuperclass() != null) {
      return directSuperclass().getField(fieldInfo);
    }
 else {
      throw new RuntimeException("String_Node_Str" + fieldInfo.getName() + "String_Node_Str"+ name()+ "String_Node_Str");
    }
  }
catch (  ClassNotFoundException e) {
    throw new RuntimeException(e);
  }
}
Program: 31724
Project: 31724
Buggy source:
/** 
 * Finds all setter methods whose parameter signature is equivalent to Array<X> or assignable from Iterable<X> where X is the generic parameter type of the Array or Iterable and the relationship type this setter is annotated with is "relationshipType"
 */
public List<MethodInfo> findIterableSetters(Class iteratedType,String relationshipType){
  List<MethodInfo> methodInfos=new ArrayList<>();
  for (  MethodInfo methodInfo : findIterableSetters(iteratedType)) {
    if (methodInfo.relationship().equals(relationshipType)) {
      methodInfos.add(methodInfo);
    }
  }
  return methodInfos;
}

Fixed version (ground truth):
/** 
 * Finds all setter methods whose parameter signature is equivalent to Array&lt;X&gt; or assignable from Iterable&lt;X&gt; where X is the generic parameter type of the Array or Iterable and the relationship type this setter is annotated with is "relationshipType"
 * @param iteratedType      the type of iterable
 * @param relationshipType  the relationship type
 * @return {@link List} of {@link MethodInfo}, never <code>null</code>
 */
public List<MethodInfo> findIterableSetters(Class iteratedType,String relationshipType){
  List<MethodInfo> methodInfos=new ArrayList<>();
  for (  MethodInfo methodInfo : findIterableSetters(iteratedType)) {
    if (methodInfo.relationship().equals(relationshipType)) {
      methodInfos.add(methodInfo);
    }
  }
  return methodInfos;
}
Program: 31725
Project: 31725
Buggy source:
/** 
 * Finds all getter methods whose parameterised return type is equivalent to Array<X> or assignable from Iterable<X> where X is the generic parameter type of the Array or Iterable and the relationship type this getter is annotated with is "relationshipType"
 */
public List<MethodInfo> findIterableGetters(Class iteratedType,String relationshipType){
  List<MethodInfo> methodInfos=new ArrayList<>();
  for (  MethodInfo methodInfo : findIterableGetters(iteratedType)) {
    if (methodInfo.relationship().equals(relationshipType)) {
      methodInfos.add(methodInfo);
    }
  }
  return methodInfos;
}

Fixed version (ground truth):
/** 
 * Finds all getter methods whose parameterised return type is equivalent to Array&lt;X&gt; or assignable from Iterable&lt;X&gt; where X is the generic parameter type of the Array or Iterable and the relationship type this getter is annotated with is "relationshipType"
 * @param iteratedType      the type of iterable
 * @param relationshipType  the relationship type
 * @return {@link List} of {@link MethodInfo}, never <code>null</code>
 */
public List<MethodInfo> findIterableGetters(Class iteratedType,String relationshipType){
  List<MethodInfo> methodInfos=new ArrayList<>();
  for (  MethodInfo methodInfo : findIterableGetters(iteratedType)) {
    if (methodInfo.relationship().equals(relationshipType)) {
      methodInfos.add(methodInfo);
    }
  }
  return methodInfos;
}
Program: 31726
Project: 31726
Buggy source:
/** 
 * Connect this class to a subclass. 
 */
public void addSubclass(ClassInfo subclass){
  if (subclass.directSuperclass != null && subclass.directSuperclass != this) {
    throw new RuntimeException(subclass.className + "String_Node_Str" + subclass.directSuperclass.className+ "String_Node_Str"+ this.className);
  }
  subclass.directSuperclass=this;
  this.directSubclasses.add(subclass);
}

Fixed version (ground truth):
/** 
 * Connect this class to a subclass.
 * @param subclass the subclass
 */
public void addSubclass(ClassInfo subclass){
  if (subclass.directSuperclass != null && subclass.directSuperclass != this) {
    throw new RuntimeException(subclass.className + "String_Node_Str" + subclass.directSuperclass.className+ "String_Node_Str"+ this.className);
  }
  subclass.directSuperclass=this;
  this.directSubclasses.add(subclass);
}
Program: 31727
Project: 31727
Buggy source:
/** 
 * A class that was previously only seen as a temp superclass of another class can now be fully hydrated. 
 */
public void hydrate(ClassInfo classInfoDetails){
  if (!this.hydrated) {
    this.hydrated=true;
    this.isAbstract=classInfoDetails.isAbstract;
    this.isInterface=classInfoDetails.isInterface;
    this.isEnum=classInfoDetails.isEnum;
    this.directSuperclassName=classInfoDetails.directSuperclassName;
    this.interfacesInfo.append(classInfoDetails.interfacesInfo());
    this.annotationsInfo.append(classInfoDetails.annotationsInfo());
    this.fieldsInfo.append(classInfoDetails.fieldsInfo());
    this.methodsInfo.append(classInfoDetails.methodsInfo());
  }
}

Fixed version (ground truth):
/** 
 * A class that was previously only seen as a temp superclass of another class can now be fully hydrated.
 * @param classInfoDetails  ClassInfo details
 */
public void hydrate(ClassInfo classInfoDetails){
  if (!this.hydrated) {
    this.hydrated=true;
    this.isAbstract=classInfoDetails.isAbstract;
    this.isInterface=classInfoDetails.isInterface;
    this.isEnum=classInfoDetails.isEnum;
    this.directSuperclassName=classInfoDetails.directSuperclassName;
    this.interfacesInfo.append(classInfoDetails.interfacesInfo());
    this.annotationsInfo.append(classInfoDetails.annotationsInfo());
    this.fieldsInfo.append(classInfoDetails.fieldsInfo());
    this.methodsInfo.append(classInfoDetails.methodsInfo());
  }
}
Program: 31728
Project: 31728
Buggy source:
/** 
 * This class was referenced as a superclass of the given subclass. 
 */
public ClassInfo(String name,ClassInfo subclass){
  this.className=name;
  this.hydrated=false;
  addSubclass(subclass);
}

Fixed version (ground truth):
/** 
 * This class was referenced as a superclass of the given subclass.
 * @param name the name of the class
 * @param subclass {@link ClassInfo} of the subclass
 */
public ClassInfo(String name,ClassInfo subclass){
  this.className=name;
  this.hydrated=false;
  addSubclass(subclass);
}
Program: 31729
Project: 31729
Buggy source:
/** 
 * The endpoint for this transaction
 * @return
 */
String url();

Fixed version (ground truth):
/** 
 * The endpoint for this transaction
 * @return the endpoint for the transaction
 */
String url();
Program: 31730
Project: 31730
Buggy source:
public static void main(String[] args){
  BrowserEngine browser=BrowserFactory.getBrowser(BrowserType.WebKit);
  Page page=browser.navigate("String_Node_Str");
  Document doc=page.getDocument();
  doc.query("String_Node_Str").click();
  page.waitUntilDocReady();
  List<Element> techNews=doc.queryAll("String_Node_Str");
  techNews.forEach(n -> {
    Element next=n.getNext();
    List<Element> anchor=next.find("String_Node_Str");
    Element first=anchor.get(0);
    String text=first.getText();
    String newsTitle=text.trim();
    System.out.println(newsTitle);
  }
);
  browser.shutdown();
}

Fixed version (ground truth):
public static void main(String[] args){
  BrowserEngine browser=BrowserFactory.getBrowser(BrowserType.WebKit);
  Page page=browser.navigate("String_Node_Str");
  Document doc=page.getDocument();
  doc.query("String_Node_Str").click();
  page.wait(1000);
  page.waitUntilDocReady();
  List<Element> techNews=doc.queryAll("String_Node_Str");
  techNews.forEach(n -> {
    Element next=n.getNext();
    List<Element> anchor=next.find("String_Node_Str");
    Element first=anchor.get(0);
    String text=first.getText();
    String newsTitle=text.trim();
    System.out.println(newsTitle);
  }
);
  browser.shutdown();
}