nus-yam/ex-repair huggingface dataset:
Program: 31637
Project: 31637
Buggy source:
public synchronized static Driver driver(){
  if (driver == null) {
    loadDriver();
  }
  return driver;
}

Fixed version (ground truth):
/** 
 * Returns the current OGM   {@link Driver}Normally only one instance of the driver exists for the lifetime of the application You cannot use this method to find out if a driver is initialised because it will attempt to initialise the driver if it is not.
 * @return an instance of the {@link Driver} to be used by the OGM
 */
public synchronized static Driver driver(){
  if (driver == null) {
    loadDriver();
  }
  return driver;
}
Program: 31638
Project: 31638
Buggy source:
private static void loadDriver(){
  if (configuration.driverConfiguration().getDriverClassName() == null) {
    autoConfigure();
  }
  setDriver(DriverService.load(configuration.driverConfiguration()));
}

Fixed version (ground truth):
/** 
 * Loads the configured Neo4j   {@link Driver} and stores it on this class
 */
private static void loadDriver(){
  if (configuration.driverConfiguration().getDriverClassName() == null) {
    autoConfigure();
  }
  setDriver(DriverService.load(configuration.driverConfiguration()));
}
Program: 31639
Project: 31639
Buggy source:
private static InputStream configurationFile(){
  String configFileName;
  configFileName=System.getenv("String_Node_Str");
  if (configFileName == null) {
    configFileName=System.getProperty("String_Node_Str");
    if (configFileName == null) {
      return classPathResource("String_Node_Str");
    }
  }
  return classPathResource(configFileName);
}

Fixed version (ground truth):
/** 
 * Tries to locate the default configuration file resource and return it as an InputStream
 * @return An InputStream resource corresponding to the default configuration file, if it exists.
 */
private static InputStream configurationFile(){
  String configFileName;
  configFileName=System.getenv("String_Node_Str");
  if (configFileName == null) {
    configFileName=System.getProperty("String_Node_Str");
    if (configFileName == null) {
      return toInputStream("String_Node_Str");
    }
  }
  return toInputStream(configFileName);
}
Program: 31640
Project: 31640
Buggy source:
public synchronized static void destroy(){
  if (driver != null) {
    driver.close();
    driver=null;
  }
  if (configuration != null) {
    configuration.clear();
  }
}

Fixed version (ground truth):
/** 
 * Releases any current driver resources and clears the current configuration
 */
public synchronized static void destroy(){
  if (driver != null) {
    driver.close();
    driver=null;
  }
  configuration.clear();
}
Program: 31641
Project: 31641
Buggy source:
private static void configure(InputStream is) throws Exception {
  configuration.clear();
  driver=null;
  Properties properties=new Properties();
  properties.load(is);
  Enumeration propertyNames=properties.propertyNames();
  while (propertyNames.hasMoreElements()) {
    String propertyName=(String)propertyNames.nextElement();
    configuration.set(propertyName,properties.getProperty(propertyName));
  }
}

Fixed version (ground truth):
/** 
 * Creates a   {@link Configuration} from an InputStream
 * @param is an InputStream
 * @throws Exception
 */
private static void configure(InputStream is) throws Exception {
  destroy();
  Properties properties=new Properties();
  properties.load(is);
  Enumeration propertyNames=properties.propertyNames();
  while (propertyNames.hasMoreElements()) {
    String propertyName=(String)propertyNames.nextElement();
    configuration.set(propertyName,properties.getProperty(propertyName));
  }
}
Program: 31642
Project: 31642
Buggy source:
public synchronized static Compiler compiler(){
  return loadCompiler();
}

Fixed version (ground truth):
/** 
 * Returns a new instance of the compiler
 * @return an instance of the {@link Compiler} to be used by the OGM
 */
public synchronized static Compiler compiler(){
  return getCompiler();
}
Program: 31643
Project: 31643
Buggy source:
/** 
 * Detects object references (including from lists) that have been deleted in the domain. These must be persisted as explicit requests to delete the corresponding relationship in the graph
 * @param compiler the {@link org.neo4j.ogm.compiler.Compiler} instance.
 */
private void deleteObsoleteRelationships(Compiler compiler){
  CompileContext context=compiler.context();
  Iterator<MappedRelationship> mappedRelationshipIterator=mappingContext.getRelationships().iterator();
  while (mappedRelationshipIterator.hasNext()) {
    MappedRelationship mappedRelationship=mappedRelationshipIterator.next();
    if (!context.removeRegisteredRelationship(mappedRelationship)) {
      logger.debug("String_Node_Str",mappedRelationship);
      Object s=mappingContext.getNodeEntity(mappedRelationship.getStartNodeId());
      Object t=mappingContext.getNodeEntity(mappedRelationship.getEndNodeId());
      if (s != null) {
        context.register(s);
      }
      if (t != null) {
        context.register(t);
      }
      compiler.unrelate(mappedRelationship.getStartNodeId(),mappedRelationship.getRelationshipType(),mappedRelationship.getEndNodeId(),mappedRelationship.getRelationshipId());
      clearRelatedObjects(mappedRelationship.getStartNodeId());
      mappingContext.removeRelationship(mappedRelationship);
    }
  }
}

Fixed version (ground truth):
/** 
 * Detects object references (including from lists) that have been deleted in the domain. These must be persisted as explicit requests to delete the corresponding relationship in the graph
 * @param compiler the {@link org.neo4j.ogm.compiler.Compiler} instance.
 */
private void deleteObsoleteRelationships(Compiler compiler){
  CompileContext context=compiler.context();
  Iterator<MappedRelationship> mappedRelationshipIterator=mappingContext.getRelationships().iterator();
  while (mappedRelationshipIterator.hasNext()) {
    MappedRelationship mappedRelationship=mappedRelationshipIterator.next();
    if (!context.removeRegisteredRelationship(mappedRelationship)) {
      logger.debug("String_Node_Str",mappedRelationship);
      compiler.unrelate(mappedRelationship.getStartNodeId(),mappedRelationship.getRelationshipType(),mappedRelationship.getEndNodeId(),mappedRelationship.getRelationshipId());
      clearRelatedObjects(mappedRelationship.getStartNodeId());
      clearRelatedObjects(mappedRelationship.getEndNodeId());
      mappingContext.removeRelationship(mappedRelationship);
    }
  }
}
Program: 31644
Project: 31644
Buggy source:
private void mapNodes(GraphModel graphModel,Set<Long> nodeIds){
  for (  Node node : graphModel.getNodes()) {
    if (!nodeIds.contains(node.getId())) {
      Object entity=mappingContext.getNodeEntity(node.getId());
      try {
        if (entity == null) {
synchronized (this) {
            entity=entityFactory.newObject(node);
            setIdentity(entity,node.getId());
            setProperties(node,entity);
            setLabels(node,entity);
          }
        }
        mappingContext.addNodeEntity(entity,node.getId());
        nodeIds.add(node.getId());
      }
 catch (      BaseClassNotFoundException e) {
        logger.debug(e.getMessage());
      }
    }
  }
}

Fixed version (ground truth):
private void mapNodes(GraphModel graphModel,Set<Long> nodeIds){
  for (  Node node : graphModel.getNodes()) {
    if (!nodeIds.contains(node.getId())) {
      Object entity=mappingContext.getNodeEntity(node.getId());
      try {
        if (entity == null) {
synchronized (this) {
            entity=entityFactory.newObject(node);
            setIdentity(entity,node.getId());
            setProperties(node,entity);
            setLabels(node,entity);
            mappingContext.addNodeEntity(entity,node.getId());
          }
        }
        nodeIds.add(node.getId());
      }
 catch (      BaseClassNotFoundException e) {
        logger.debug(e.getMessage());
      }
    }
  }
}
Program: 31645
Project: 31645
Buggy source:
private void remember(Object entity){
  ClassInfo classInfo=metaData.classInfo(entity);
  Long id=(Long)EntityAccessManager.getIdentityPropertyReader(classInfo).readProperty(entity);
  objectMemo.remember(id,entity,classInfo);
  FieldInfo fieldInfo=classInfo.labelFieldOrNull();
  if (fieldInfo != null) {
    FieldReader reader=new FieldReader(classInfo,fieldInfo);
    Collection<String> labels=(Collection<String>)reader.read(entity);
    labelHistory(id).push(labels);
  }
}

Fixed version (ground truth):
private void remember(Object entity){
  ClassInfo classInfo=metaData.classInfo(entity);
  Long id=(Long)EntityAccessManager.getIdentityPropertyReader(classInfo).readProperty(entity);
  objectMemo.remember(id,entity,classInfo);
}
Program: 31646
Project: 31646
Buggy source:
public Object addRelationshipEntity(Object relationshipEntity,Long id){
  if (relationshipEntityRegister.add(id,relationshipEntity)) {
    relationshipEntity=relationshipEntityRegister.get(id);
    addType(relationshipEntity.getClass(),relationshipEntity,id);
  }
  remember(relationshipEntity);
  return relationshipEntity;
}

Fixed version (ground truth):
public Object addRelationshipEntity(Object relationshipEntity,Long id){
  if (relationshipEntityRegister.add(id,relationshipEntity)) {
    relationshipEntity=relationshipEntityRegister.get(id);
    addType(relationshipEntity.getClass(),relationshipEntity,id);
    remember(relationshipEntity);
  }
  return relationshipEntity;
}
Program: 31647
Project: 31647
Buggy source:
public void replaceNodeEntity(Object entity,Long id){
  nodeEntityRegister.remove(id);
  addNodeEntity(entity,id);
  remember(entity);
}

Fixed version (ground truth):
public void replaceNodeEntity(Object entity,Long id){
  nodeEntityRegister.remove(id);
  addNodeEntity(entity,id);
}
Program: 31648
Project: 31648
Buggy source:
public Object addNodeEntity(Object entity,Long id){
  if (nodeEntityRegister.add(id,entity)) {
    entity=nodeEntityRegister.get(id);
    addType(entity.getClass(),entity,id);
  }
  remember(entity);
  return entity;
}

Fixed version (ground truth):
public Object addNodeEntity(Object entity,Long id){
  if (nodeEntityRegister.add(id,entity)) {
    entity=nodeEntityRegister.get(id);
    addType(entity.getClass(),entity,id);
    remember(entity);
    collectLabelHistory(entity);
  }
  return entity;
}
Program: 31649
Project: 31649
Buggy source:
public boolean add(Long id,Object entity){
  if (register.putIfAbsent(id,entity) == null) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean add(Long id,Object entity){
  if (register.putIfAbsent(id,entity) == null) {
    LOGGER.debug("String_Node_Str",id,entity);
    return true;
  }
  LOGGER.debug("String_Node_Str",id,entity);
  return false;
}
Program: 31650
Project: 31650
Buggy source:
public void clear(){
  register.clear();
}

Fixed version (ground truth):
public void clear(){
  LOGGER.debug("String_Node_Str");
  register.clear();
}
Program: 31651
Project: 31651
Buggy source:
public void remove(Long id){
  register.remove(id);
}

Fixed version (ground truth):
public void remove(Long id){
  LOGGER.debug("String_Node_Str",id);
  register.remove(id);
}
Program: 31652
Project: 31652
Buggy source:
private StatementResult executeRequest(Statement request){
  BoltTransaction tx;
  try {
    String params=mapper.writeValueAsString(request.getParameters());
    TypeReference<HashMap<String,Object>> typeRef=new TypeReference<HashMap<String,Object>>(){
    }
;
    HashMap<String,Object> parameterMap=mapper.readValue(params.getBytes(),typeRef);
    LOGGER.info("String_Node_Str",request.getStatement(),parameterMap);
    if (transactionManager.getCurrentTransaction() == null) {
      org.neo4j.ogm.transaction.Transaction autoCommitTx=transactionManager.openTransaction();
      tx=(BoltTransaction)autoCommitTx;
      StatementResult statementResult=tx.nativeBoltTransaction().run(request.getStatement(),parameterMap);
      tx.commit();
      tx.close();
      return statementResult;
    }
    tx=(BoltTransaction)transactionManager.getCurrentTransaction();
    return tx.nativeBoltTransaction().run(request.getStatement(),request.getParameters());
  }
 catch (  CypherException|ConnectionException ce) {
    throw ce;
  }
catch (  ClientException ce) {
    tx=(BoltTransaction)transactionManager.getCurrentTransaction();
    if (tx != null) {
      tx.rollback();
    }
    throw new CypherException("String_Node_Str",ce,ce.neo4jErrorCode(),ce.getMessage());
  }
catch (  Exception e) {
    tx=(BoltTransaction)transactionManager.getCurrentTransaction();
    if (tx != null) {
      tx.rollback();
    }
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
private StatementResult executeRequest(Statement request){
  BoltTransaction tx;
  try {
    String params=mapper.writeValueAsString(request.getParameters());
    TypeReference<HashMap<String,Object>> typeRef=new TypeReference<HashMap<String,Object>>(){
    }
;
    HashMap<String,Object> parameterMap=mapper.readValue(params.getBytes(),typeRef);
    LOGGER.info("String_Node_Str",request.getStatement(),parameterMap);
    if (transactionManager.getCurrentTransaction() == null) {
      org.neo4j.ogm.transaction.Transaction autoCommitTx=transactionManager.openTransaction();
      tx=(BoltTransaction)autoCommitTx;
      StatementResult statementResult=tx.nativeBoltTransaction().run(request.getStatement(),parameterMap);
      tx.commit();
      tx.close();
      return statementResult;
    }
    tx=(BoltTransaction)transactionManager.getCurrentTransaction();
    return tx.nativeBoltTransaction().run(request.getStatement(),parameterMap);
  }
 catch (  CypherException|ConnectionException ce) {
    throw ce;
  }
catch (  ClientException ce) {
    tx=(BoltTransaction)transactionManager.getCurrentTransaction();
    if (tx != null) {
      tx.rollback();
    }
    throw new CypherException("String_Node_Str",ce,ce.neo4jErrorCode(),ce.getMessage());
  }
catch (  Exception e) {
    tx=(BoltTransaction)transactionManager.getCurrentTransaction();
    if (tx != null) {
      tx.rollback();
    }
    throw new RuntimeException(e);
  }
}
Program: 31654
Project: 31654
Buggy source:
private void removeTransientClass(ClassInfo transientClass){
  if (transientClass != null && !transientClass.name().equals("String_Node_Str")) {
    LOGGER.debug("String_Node_Str",transientClass.name());
    classNameToClassInfo.remove(transientClass.name());
    for (    ClassInfo transientChild : transientClass.directSubclasses()) {
      removeTransientClass(transientChild);
    }
    for (    ClassInfo transientChild : transientClass.directImplementingClasses()) {
      removeTransientClass(transientChild);
    }
  }
}

Fixed version (ground truth):
private Set<Class> removeTransientClass(ClassInfo transientClass){
  Set<Class> removed=new HashSet<>();
  if (transientClass != null && !transientClass.name().equals("String_Node_Str")) {
    LOGGER.debug("String_Node_Str",transientClass.name());
    classNameToClassInfo.remove(transientClass.name());
    removed.add(transientClass.getUnderlyingClass());
    for (    ClassInfo transientChild : transientClass.directSubclasses()) {
      removeTransientClass(transientChild);
    }
    for (    ClassInfo transientChild : transientClass.directImplementingClasses()) {
      removeTransientClass(transientChild);
    }
  }
  return removed;
}
Program: 31656
Project: 31656
Buggy source:
public DomainInfo(String... packages){
  long now=-System.currentTimeMillis();
  packagesMarkedForScanning=packages;
  load(packages);
  LOGGER.info("String_Node_Str",classNameToClassInfo.entrySet().size(),(now + System.currentTimeMillis()));
}

Fixed version (ground truth):
public DomainInfo(String... packages){
  long now=-System.currentTimeMillis();
  load(packages);
  LOGGER.info("String_Node_Str",classNameToClassInfo.entrySet().size(),(now + System.currentTimeMillis()));
}
Program: 31657
Project: 31657
Buggy source:
@Override public void finish(){
  LOGGER.info("String_Node_Str");
  buildAnnotationNameToClassInfoMap();
  buildInterfaceNameToClassInfoMap();
  registerDefaultTypeConverters();
  List<ClassInfo> transientClasses=new ArrayList<>();
  for (  ClassInfo classInfo : classNameToClassInfo.values()) {
    if (classInfo.name() == null || classInfo.name().equals("String_Node_Str"))     continue;
    LOGGER.debug("String_Node_Str",classInfo.name());
    if (classInfo.isTransient()) {
      LOGGER.debug("String_Node_Str",classInfo.name());
      transientClasses.add(classInfo);
      continue;
    }
    if (classInfo.superclassName() == null || classInfo.superclassName().equals("String_Node_Str")) {
      extend(classInfo,classInfo.directSubclasses());
    }
    for (    InterfaceInfo interfaceInfo : classInfo.interfacesInfo().list()) {
      implement(classInfo,interfaceInfo);
    }
  }
  LOGGER.debug("String_Node_Str");
  Collection<ArrayList<ClassInfo>> interfaceInfos=interfaceNameToClassInfo.values();
  for (  ArrayList<ClassInfo> classInfos : interfaceInfos) {
    for (    ClassInfo classInfo : classInfos) {
      if (classInfo.isTransient()) {
        LOGGER.debug("String_Node_Str",classInfo.name());
        transientClasses.add(classInfo);
      }
    }
  }
  for (  ClassInfo transientClass : transientClasses) {
    removeTransientClass(transientClass);
  }
  checkOutOfPackageRefferences();
  LOGGER.info("String_Node_Str");
}

Fixed version (ground truth):
@Override public void finish(){
  LOGGER.info("String_Node_Str");
  buildAnnotationNameToClassInfoMap();
  buildInterfaceNameToClassInfoMap();
  List<ClassInfo> transientClasses=new ArrayList<>();
  for (  ClassInfo classInfo : classNameToClassInfo.values()) {
    if (classInfo.name() == null || classInfo.name().equals("String_Node_Str"))     continue;
    LOGGER.debug("String_Node_Str",classInfo.name());
    if (classInfo.isTransient()) {
      LOGGER.debug("String_Node_Str",classInfo.name());
      transientClasses.add(classInfo);
      continue;
    }
    if (classInfo.superclassName() == null || classInfo.superclassName().equals("String_Node_Str")) {
      extend(classInfo,classInfo.directSubclasses());
    }
    for (    InterfaceInfo interfaceInfo : classInfo.interfacesInfo().list()) {
      implement(classInfo,interfaceInfo);
    }
  }
  LOGGER.debug("String_Node_Str");
  Collection<ArrayList<ClassInfo>> interfaceInfos=interfaceNameToClassInfo.values();
  for (  ArrayList<ClassInfo> classInfos : interfaceInfos) {
    for (    ClassInfo classInfo : classInfos) {
      if (classInfo.isTransient()) {
        LOGGER.debug("String_Node_Str",classInfo.name());
        transientClasses.add(classInfo);
      }
    }
  }
  Set<Class> transientClassesRemoved=new HashSet<>();
  for (  ClassInfo transientClass : transientClasses) {
    transientClassesRemoved.addAll(removeTransientClass(transientClass));
  }
  LOGGER.debug("String_Node_Str");
  postProcessFields(transientClassesRemoved);
  postProcessMethods(transientClassesRemoved);
  LOGGER.info("String_Node_Str");
}
Program: 31659
Project: 31659
Buggy source:
private void purge(Object entity,PropertyReader identityReader,Class type){
  Long id=(Long)identityReader.read(entity);
  if (id != null) {
    if (nodeEntityRegister.containsKey(id)) {
      nodeEntityRegister.remove(id);
      Iterator<MappedRelationship> mappedRelationshipIterator=mappedRelationships().iterator();
      while (mappedRelationshipIterator.hasNext()) {
        MappedRelationship mappedRelationship=mappedRelationshipIterator.next();
        if (mappedRelationship.getStartNodeId() == id || mappedRelationship.getEndNodeId() == id) {
          mappedRelationshipIterator.remove();
        }
      }
    }
    if (metaData.isRelationshipEntity(type.getName()) && relationshipEntityRegister.containsKey(id)) {
      relationshipEntityRegister.remove(id);
      RelationalReader startNodeReader=entityAccessStrategy.getStartNodeReader(metaData.classInfo(entity));
      clear(startNodeReader.read(entity));
      RelationalReader endNodeReader=entityAccessStrategy.getEndNodeReader(metaData.classInfo(entity));
      clear(endNodeReader.read(entity));
    }
  }
}

Fixed version (ground truth):
private void purge(Object entity,PropertyReader identityReader,Class type){
  Long id=(Long)identityReader.read(entity);
  if (id != null) {
    if (!metaData.isRelationshipEntity(type.getName())) {
      if (nodeEntityRegister.containsKey(id)) {
        nodeEntityRegister.remove(id);
        Iterator<MappedRelationship> mappedRelationshipIterator=mappedRelationships().iterator();
        while (mappedRelationshipIterator.hasNext()) {
          MappedRelationship mappedRelationship=mappedRelationshipIterator.next();
          if (mappedRelationship.getStartNodeId() == id || mappedRelationship.getEndNodeId() == id) {
            mappedRelationshipIterator.remove();
          }
        }
      }
    }
 else {
      if (relationshipEntityRegister.containsKey(id)) {
        relationshipEntityRegister.remove(id);
        RelationalReader startNodeReader=entityAccessStrategy.getStartNodeReader(metaData.classInfo(entity));
        Object startNode=startNodeReader.read(entity);
        clear(startNode);
        RelationalReader endNodeReader=entityAccessStrategy.getEndNodeReader(metaData.classInfo(entity));
        Object endNode=endNodeReader.read(entity);
        clear(endNode);
      }
    }
  }
}
Program: 31660
Project: 31660
Buggy source:
public Configuration(String propertiesFilename){
  configure(propertiesFilename);
}

Fixed version (ground truth):
public Configuration(String propertiesFilename){
  driverConfiguration=null;
  compilerConfiguration=null;
  configure(propertiesFilename);
}
Program: 31661
Project: 31661
Buggy source:
public CompilerConfiguration compilerConfiguration(){
  return new CompilerConfiguration(this);
}

Fixed version (ground truth):
public synchronized CompilerConfiguration compilerConfiguration(){
  if (compilerConfiguration == null) {
    compilerConfiguration=new CompilerConfiguration(this);
  }
  return compilerConfiguration;
}
Program: 31662
Project: 31662
Buggy source:
public DriverConfiguration driverConfiguration(){
  return new DriverConfiguration(this);
}

Fixed version (ground truth):
public synchronized DriverConfiguration driverConfiguration(){
  if (driverConfiguration == null) {
    driverConfiguration=new DriverConfiguration(this);
  }
  return driverConfiguration;
}
Program: 31663
Project: 31663
Buggy source:
private static void loadDriver(){
  if (configuration.driverConfiguration().getDriverClassName() == null) {
    autoConfigure();
  }
  setDriver(DriverService.load(new DriverConfiguration(configuration)));
}

Fixed version (ground truth):
private static void loadDriver(){
  if (configuration.driverConfiguration().getDriverClassName() == null) {
    autoConfigure();
  }
  setDriver(DriverService.load(configuration.driverConfiguration()));
}
Program: 31664
Project: 31664
Buggy source:
private static void configure(InputStream is) throws Exception {
  configuration=new Configuration();
  driver=null;
  Properties properties=new Properties();
  properties.load(is);
  Enumeration propertyNames=properties.propertyNames();
  while (propertyNames.hasMoreElements()) {
    String propertyName=(String)propertyNames.nextElement();
    configuration.set(propertyName,properties.getProperty(propertyName));
  }
}

Fixed version (ground truth):
private static void configure(InputStream is) throws Exception {
  configuration.clear();
  driver=null;
  Properties properties=new Properties();
  properties.load(is);
  Enumeration propertyNames=properties.propertyNames();
  while (propertyNames.hasMoreElements()) {
    String propertyName=(String)propertyNames.nextElement();
    configuration.set(propertyName,properties.getProperty(propertyName));
  }
}
Program: 31665
Project: 31665
Buggy source:
private static Compiler loadCompiler(){
  if (configuration.compilerConfiguration().getCompilerClassName() == null) {
    autoConfigure();
  }
  return CompilerService.load(new CompilerConfiguration(configuration));
}

Fixed version (ground truth):
private static Compiler loadCompiler(){
  if (configuration.compilerConfiguration().getCompilerClassName() == null) {
    autoConfigure();
  }
  return CompilerService.load(configuration.compilerConfiguration());
}
Program: 31666
Project: 31666
Buggy source:
@Override public void configure(DriverConfiguration config){
  super.configure(config);
  close();
  Config driverConfig=buildDriverConfig(config);
  if (config.getCredentials() != null) {
    UsernamePasswordCredentials credentials=(UsernamePasswordCredentials)config.getCredentials();
    AuthToken authToken=AuthTokens.basic(credentials.getUsername(),credentials.getPassword());
    boltDriver=GraphDatabase.driver(config.getURI(),authToken,driverConfig);
  }
 else {
    boltDriver=GraphDatabase.driver(config.getURI(),driverConfig);
    LOGGER.debug("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void configure(DriverConfiguration config){
  close();
  super.configure(config);
  Config driverConfig=buildDriverConfig(config);
  if (config.getCredentials() != null) {
    UsernamePasswordCredentials credentials=(UsernamePasswordCredentials)config.getCredentials();
    AuthToken authToken=AuthTokens.basic(credentials.getUsername(),credentials.getPassword());
    boltDriver=GraphDatabase.driver(config.getURI(),authToken,driverConfig);
  }
 else {
    boltDriver=GraphDatabase.driver(config.getURI(),driverConfig);
    LOGGER.debug("String_Node_Str");
  }
}
Program: 31667
Project: 31667
Buggy source:
/** 
 * Constructs a new   {@link SessionFactory} by initialising the object-graph mapping meta-data from the given list of domainobject packages. <p> The package names passed to this constructor should not contain wildcards or trailing full stops, for example, "org.springframework.data.neo4j.example.domain" would be fine.  The default behaviour is for sub-packages to be scanned and you can also specify fully-qualified class names if you want to cherry pick particular classes. </p>
 * @param packages The packages to scan for domain objects
 */
public SessionFactory(String... packages){
  this.metaData=new MetaData(packages);
}

Fixed version (ground truth):
/** 
 * Constructs a new   {@link SessionFactory} by initialising the object-graph mapping meta-data from the given list of domainobject packages. Uses an externally created HttpClient instance <p> The package names passed to this constructor should not contain wildcards or trailing full stops, for example, "org.springframework.data.neo4j.example.domain" would be fine.  The default behaviour is for sub-packages to be scanned and you can also specify fully-qualified class names if you want to cherry pick particular classes. </p>
 * @param packages The packages to scan for domain objects
 */
public SessionFactory(CloseableHttpClient httpClient,String... packages){
  this.httpClient=httpClient;
  this.metaData=new MetaData(packages);
}
Program: 31669
Project: 31669
Buggy source:
private void parseErrors(String header){
  int cp=header.indexOf(ERRORS_TOKEN);
  if (cp == -1) {
    cp=header.indexOf(COMMIT_ERRORS_TOKEN);
  }
  if (cp == -1) {
    throw new RuntimeException("String_Node_Str" + header + "String_Node_Str");
  }
  StringBuilder sb=new StringBuilder(header);
  String response;
  try {
    while ((response=scanner.next()) != null) {
      sb.append(response);
    }
  }
 catch (  Exception e) {
    scanner.close();
  }
  throw new ResultProcessingException(sb.substring(cp + 2),null);
}

Fixed version (ground truth):
private void parseErrors(String header){
  int cp=header.indexOf(ERRORS_TOKEN);
  if (cp == -1) {
    cp=header.indexOf(COMMIT_ERRORS_TOKEN);
  }
  if (cp == -1) {
    close();
    throw new ResultProcessingException("String_Node_Str" + header + "String_Node_Str",null);
  }
  StringBuilder sb=new StringBuilder(header);
  String response;
  try {
    while ((response=scanner.next()) != null) {
      sb.append(response);
    }
  }
 catch (  Exception e) {
    scanner.close();
  }
  String errorMessage=sb.substring(cp + 2);
  close();
  throw new ResultProcessingException(errorMessage,null);
}
Program: 31670
Project: 31670
Buggy source:
public void rollback(){
  transactionRequestHandler.rollback(this);
  super.rollback();
}

Fixed version (ground truth):
public void rollback(){
  super.rollback();
  transactionRequestHandler.rollback(this);
}
Program: 31671
Project: 31671
Buggy source:
public void commit(){
  transactionRequestHandler.commit(this);
  super.commit();
}

Fixed version (ground truth):
public void commit(){
  super.commit();
  transactionRequestHandler.commit(this);
}
Program: 31672
Project: 31672
Buggy source:
public void close(){
  if (this.status().equals(Status.OPEN) || this.status().equals(Status.PENDING)) {
    transactionRequestHandler.rollback(this);
  }
  super.close();
}

Fixed version (ground truth):
public void close(){
  super.close();
  if (this.status().equals(Status.OPEN) || this.status().equals(Status.PENDING)) {
    transactionRequestHandler.rollback(this);
  }
}
Program: 31673
Project: 31673
Buggy source:
public void rollback(Transaction tx){
  String url=tx.url();
  logger.debug("String_Node_Str",url);
  HttpDelete request=new HttpDelete(url);
  executeRequest(request);
}

Fixed version (ground truth):
public void rollback(Transaction tx){
  String url=tx.url();
  logger.debug("String_Node_Str",url);
  HttpDelete request=new HttpDelete(url);
  try (CloseableHttpResponse response=executeRequest(request)){
    ;
  }
 catch (  ResultProcessingException rpe) {
    logger.warn("String_Node_Str" + rpe.getCause().getLocalizedMessage());
    throw rpe;
  }
catch (  IOException ioe) {
    throw new RuntimeException("String_Node_Str",ioe);
  }
}
Program: 31674
Project: 31674
Buggy source:
public void commit(Transaction tx){
  String url=tx.url() + "String_Node_Str";
  logger.debug("String_Node_Str",url);
  HttpPost request=new HttpPost(url);
  request.setHeader(new BasicHeader(HTTP.CONTENT_TYPE,"String_Node_Str"));
  executeRequest(request);
}

Fixed version (ground truth):
public void commit(Transaction tx){
  String url=tx.url() + "String_Node_Str";
  logger.debug("String_Node_Str",url);
  HttpPost request=new HttpPost(url);
  request.setHeader(new BasicHeader(HTTP.CONTENT_TYPE,"String_Node_Str"));
  try (CloseableHttpResponse response=executeRequest(request)){
    ;
    response.close();
  }
 catch (  ResultProcessingException rpe) {
    logger.warn("String_Node_Str" + rpe.getCause().getLocalizedMessage());
    throw rpe;
  }
catch (  IOException ioe) {
    throw new RuntimeException("String_Node_Str",ioe);
  }
}
Program: 31675
Project: 31675
Buggy source:
private String newTransactionEndpointUrl(){
  logger.debug("String_Node_Str",url);
  HttpPost request=new HttpPost(url);
  request.setHeader(new BasicHeader(HTTP.CONTENT_TYPE,"String_Node_Str"));
  HttpResponse response=executeRequest(request);
  Header location=response.getHeaders("String_Node_Str")[0];
  return location.getValue();
}

Fixed version (ground truth):
private String newTransactionEndpointUrl(){
  logger.debug("String_Node_Str",url);
  HttpPost request=new HttpPost(url);
  request.setHeader(new BasicHeader(HTTP.CONTENT_TYPE,"String_Node_Str"));
  CloseableHttpResponse response=executeRequest(request);
  Header location=response.getHeaders("String_Node_Str")[0];
  try {
    response.close();
  }
 catch (  Exception ioe) {
    throw new RuntimeException("String_Node_Str",ioe);
  }
  return location.getValue();
}
Program: 31676
Project: 31676
Buggy source:
private HttpResponse executeRequest(HttpRequestBase request){
  try {
    request.setHeader(new BasicHeader("String_Node_Str","String_Node_Str"));
    HttpRequestAuthorization.authorize(request,credentials);
    HttpResponse response=httpClient.execute(request);
    StatusLine statusLine=response.getStatusLine();
    logger.debug("String_Node_Str",statusLine.getStatusCode());
    if (statusLine.getStatusCode() >= 300) {
      throw new HttpResponseException(statusLine.getStatusCode(),statusLine.getReasonPhrase());
    }
    HttpEntity responseEntity=response.getEntity();
    if (responseEntity != null) {
      String responseText=EntityUtils.toString(responseEntity);
      logger.debug(responseText);
      EntityUtils.consume(responseEntity);
      if (responseText.contains("String_Node_Str") || responseText.contains("String_Node_Str")) {
        throw new ErrorsException(responseText);
      }
    }
    return response;
  }
 catch (  Exception e) {
    throw new ResultProcessingException("String_Node_Str",e);
  }
 finally {
    request.releaseConnection();
    transaction.remove();
  }
}

Fixed version (ground truth):
private CloseableHttpResponse executeRequest(HttpRequestBase request){
  CloseableHttpResponse response=null;
  try {
    request.setHeader(new BasicHeader("String_Node_Str","String_Node_Str"));
    HttpRequestAuthorization.authorize(request,credentials);
    response=httpClient.execute(request);
    StatusLine statusLine=response.getStatusLine();
    logger.debug("String_Node_Str",statusLine.getStatusCode());
    if (statusLine.getStatusCode() >= 300) {
      throw new HttpResponseException(statusLine.getStatusCode(),statusLine.getReasonPhrase());
    }
    HttpEntity responseEntity=response.getEntity();
    if (responseEntity != null) {
      String responseText=EntityUtils.toString(responseEntity);
      logger.debug(responseText);
      EntityUtils.consume(responseEntity);
      if (responseText.contains("String_Node_Str") || responseText.contains("String_Node_Str")) {
        throw new ErrorsException(responseText);
      }
    }
    return response;
  }
 catch (  Exception e) {
    if (response != null) {
      try {
        response.close();
      }
 catch (      IOException ioe) {
        throw new RuntimeException("String_Node_Str",ioe);
      }
    }
    throw new ResultProcessingException("String_Node_Str",e);
  }
 finally {
    request.releaseConnection();
    transaction.remove();
  }
}
Program: 31677
Project: 31677
Buggy source:
@Override public synchronized void configure(DriverConfiguration config){
  super.configure(config);
  close();
  try {
    String fileStoreUri=config.getURI();
    if (fileStoreUri == null) {
      fileStoreUri=createTemporaryEphemeralFileStore();
      config.setURI(fileStoreUri);
    }
    File file=new File(new URI(fileStoreUri));
    graphDatabaseService=new GraphDatabaseFactory().newEmbeddedDatabase(file.getAbsolutePath());
    registerShutdownHook();
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override public synchronized void configure(DriverConfiguration config){
  super.configure(config);
  close();
  try {
    String fileStoreUri=config.getURI();
    if (fileStoreUri == null) {
      fileStoreUri=createTemporaryEphemeralFileStore();
    }
    File file=new File(new URI(fileStoreUri));
    graphDatabaseService=new GraphDatabaseFactory().newEmbeddedDatabase(file.getAbsolutePath());
    registerShutdownHook();
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 31678
Project: 31678
Buggy source:
private String createTemporaryEphemeralFileStore(){
  try {
    Path path=Files.createTempDirectory("String_Node_Str");
    File f=path.toFile();
    f.deleteOnExit();
    URI uri=f.toURI();
    String fileStoreUri=uri.toString();
    return fileStoreUri;
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
private String createTemporaryEphemeralFileStore(){
  try {
    System.out.format("String_Node_Str",System.getProperty("String_Node_Str"));
    Path path=Files.createTempDirectory("String_Node_Str");
    System.out.format("String_Node_Str",path.toString());
    File f=path.toFile();
    System.out.format("String_Node_Str",f.exists());
    f.deleteOnExit();
    URI uri=f.toURI();
    System.out.format("String_Node_Str",uri != null);
    System.out.format("String_Node_Str",uri.toString());
    String fileStoreUri=uri.toString();
    return fileStoreUri;
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str");
    e.printStackTrace();
    throw new RuntimeException(e);
  }
}
Program: 31679
Project: 31679
Buggy source:
@Override public void commit(){
  if (transactionManager != null && transactionManager.getCurrentTransaction() != null) {
    try {
      HttpPost request=new HttpPost(url);
      request.setHeader(new BasicHeader(HTTP.CONTENT_TYPE,"String_Node_Str"));
      driver.executeHttpRequest(request);
    }
 catch (    Exception e) {
      throw new TransactionException(e.getLocalizedMessage());
    }
  }
  super.commit();
}

Fixed version (ground truth):
@Override public void commit(){
  if (transactionManager != null && transactionManager.getCurrentTransaction() != null) {
    try {
      HttpPost request=new HttpPost(url + "String_Node_Str");
      request.setHeader(new BasicHeader(HTTP.CONTENT_TYPE,"String_Node_Str"));
      driver.executeHttpRequest(request);
    }
 catch (    Exception e) {
      throw new TransactionException(e.getLocalizedMessage());
    }
  }
  super.commit();
}
Program: 31680
Project: 31680
Buggy source:
@Test public void shouldRollbackLongTransaction(){
  try (Transaction tx=session.beginTransaction()){
    Collection<Satellite> satellites=session.loadAll(Satellite.class);
    assertEquals(11,satellites.size());
    Satellite satellite=satellites.iterator().next();
    Long id=satellite.getId();
    String name=satellite.getName();
    satellite.setName("String_Node_Str");
    session.save(satellite);
    Satellite updatedSatellite=session.load(Satellite.class,id);
    assertEquals("String_Node_Str",updatedSatellite.getName());
    tx.rollback();
    updatedSatellite=session.load(Satellite.class,id);
    assertEquals(name,updatedSatellite.getName());
  }
 }

Fixed version (ground truth):
@Test public void shouldRollbackLongTransaction(){
  Long id;
  String name;
  try (Transaction tx=session.beginTransaction()){
    Collection<Satellite> satellites=session.loadAll(Satellite.class);
    assertEquals(11,satellites.size());
    Satellite satellite=satellites.iterator().next();
    id=satellite.getId();
    name=satellite.getName();
    satellite.setName("String_Node_Str");
    session.save(satellite);
    session.clear();
    Satellite updatedSatellite=session.load(Satellite.class,id);
    assertEquals("String_Node_Str",updatedSatellite.getName());
    tx.rollback();
  }
   session.clear();
  Satellite reloadedSatellite=session.load(Satellite.class,id);
  assertEquals(name,reloadedSatellite.getName());
}
Program: 31681
Project: 31681
Buggy source:
@Test public void shouldCommitLongTransaction(){
  try (Transaction tx=session.beginTransaction()){
    Collection<Satellite> satellites=session.loadAll(Satellite.class);
    assertEquals(11,satellites.size());
    Satellite satellite=satellites.iterator().next();
    Long id=satellite.getId();
    satellite.setName("String_Node_Str");
    session.save(satellite);
    Satellite updatedSatellite=session.load(Satellite.class,id);
    assertEquals("String_Node_Str",updatedSatellite.getName());
    tx.commit();
    updatedSatellite=session.load(Satellite.class,id);
    assertEquals("String_Node_Str",updatedSatellite.getName());
  }
 }

Fixed version (ground truth):
@Test public void shouldCommitLongTransaction(){
  Long id;
  try (Transaction tx=session.beginTransaction()){
    Collection<Satellite> satellites=session.loadAll(Satellite.class);
    assertEquals(11,satellites.size());
    Satellite satellite=satellites.iterator().next();
    id=satellite.getId();
    satellite.setName("String_Node_Str");
    session.save(satellite);
    session.clear();
    Satellite updatedSatellite=session.load(Satellite.class,id);
    assertEquals("String_Node_Str",updatedSatellite.getName());
    tx.commit();
  }
   session.clear();
  Satellite reloadedSatellite=session.load(Satellite.class,id);
  assertEquals("String_Node_Str",reloadedSatellite.getName());
}
Program: 31682
Project: 31682
Buggy source:
public void setRelationship_deleted(int relationship_deleted){
  this.relationship_deleted=relationship_deleted;
  this.relationships_deleted=relationship_deleted;
}

Fixed version (ground truth):
public void setRelationship_deleted(int relationship_deleted){
  this.relationship_deleted=relationship_deleted;
}
Program: 31683
Project: 31683
Buggy source:
void setRelationships_deleted(int relationships_deleted){
  this.relationships_deleted=relationships_deleted;
  this.relationship_deleted=relationships_deleted;
}

Fixed version (ground truth):
void setRelationships_deleted(int relationships_deleted){
  this.relationships_deleted=relationships_deleted;
}
Program: 31684
Project: 31684
Buggy source:
/** 
 * Produce a string in double quotes with backslash sequences in all the right places. A backslash will be inserted within </, allowing JSON text to be delivered in HTML. In JSON text, a string cannot contain a control character or an unescaped quote or backslash.
 * @param string A String
 * @return  A String correctly formatted for insertion in a JSON text.
 */
public static String quote(String string){
  if (string == null || string.length() == 0) {
    return "String_Node_Str";
  }
  char b;
  char c=0;
  int i;
  int len=string.length();
  StringBuffer sb=new StringBuffer(len + 4);
  String t;
  sb.append('"');
  for (i=0; i < len; i+=1) {
    b=c;
    c=string.charAt(i);
switch (c) {
case '\\':
case '"':
      sb.append('\\');
    sb.append(c);
  break;
case '/':
if (b == '<') {
  sb.append('\\');
}
sb.append(c);
break;
case '\b':
sb.append("String_Node_Str");
break;
case '\t':
sb.append("String_Node_Str");
break;
case '\n':
sb.append("String_Node_Str");
break;
case '\f':
sb.append("String_Node_Str");
break;
case '\r':
sb.append("String_Node_Str");
break;
default :
if (c < ' ' || (c >= '\u0080' && c < '\u00a0') || (c >= '\u2000' && c < '\u2100')) {
t="String_Node_Str" + Integer.toHexString(c);
sb.append("String_Node_Str" + t.substring(t.length() - 4));
}
 else {
sb.append(c);
}
}
}
sb.append('"');
return sb.toString();
}

Fixed version (ground truth):
/** 
 * Produce a string in double quotes with backslash sequences in all the right places. A backslash will be inserted within &lt;/, allowing JSON text to be delivered in HTML. In JSON text, a string cannot contain a control character or an unescaped quote or backslash.
 * @param string A String
 * @return  A String correctly formatted for insertion in a JSON text.
 */
public static String quote(String string){
  if (string == null || string.length() == 0) {
    return "String_Node_Str";
  }
  char b;
  char c=0;
  int i;
  int len=string.length();
  StringBuffer sb=new StringBuffer(len + 4);
  String t;
  sb.append('"');
  for (i=0; i < len; i+=1) {
    b=c;
    c=string.charAt(i);
switch (c) {
case '\\':
case '"':
      sb.append('\\');
    sb.append(c);
  break;
case '/':
if (b == '<') {
  sb.append('\\');
}
sb.append(c);
break;
case '\b':
sb.append("String_Node_Str");
break;
case '\t':
sb.append("String_Node_Str");
break;
case '\n':
sb.append("String_Node_Str");
break;
case '\f':
sb.append("String_Node_Str");
break;
case '\r':
sb.append("String_Node_Str");
break;
default :
if (c < ' ' || (c >= '\u0080' && c < '\u00a0') || (c >= '\u2000' && c < '\u2100')) {
t="String_Node_Str" + Integer.toHexString(c);
sb.append("String_Node_Str" + t.substring(t.length() - 4));
}
 else {
sb.append(c);
}
}
}
sb.append('"');
return sb.toString();
}
Program: 31685
Project: 31685
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> baseClasses=new HashSet<>();
    for (    String taxon : taxa) {
      ClassInfo taxonClassInfo=classInfo(taxon);
      if (taxonClassInfo != null) {
        ClassInfo superclassInfo=classInfo(taxonClassInfo.superclassName());
        if (baseClasses.contains(superclassInfo)) {
          baseClasses.remove(superclassInfo);
          baseClasses.add(taxonClassInfo);
        }
 else {
          ClassInfo baseClassInfo=findSingleBaseClass(taxonClassInfo,taxonClassInfo.directSubclasses());
          if (baseClassInfo != null && !baseClasses.contains(baseClassInfo)) {
            baseClasses.add(taxonClassInfo);
          }
 else {
            ClassInfo singleImplementor=findSingleImplementor(taxon);
            if (singleImplementor != null) {
              baseClasses.add(singleImplementor);
            }
          }
        }
      }
    }
    if (baseClasses.size() > 1) {
      throw new AmbiguousBaseClassException(Arrays.toString(taxa));
    }
    if (baseClasses.iterator().hasNext()) {
      return baseClasses.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=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;
}