nus-yam/ex-repair huggingface dataset:
Program: 155011
Project: 155011
Buggy source:
private boolean getMessage(){
  if (!acquireReadBuffer()) {
    return false;
  }
  try {
    buffer.limit(17);
    int read=connection.read();
    if (read == 17) {
      buffer.flip();
      byte request=buffer.get();
      if (request != HeaderConstants.OFFER_LOG) {
        log("String_Node_Str" + request);
        close();
        return true;
      }
      long version=buffer.getLong();
      if (version < slave.getVersion()) {
        log("String_Node_Str" + version + "String_Node_Str");
        setStatus(Status.SETUP_NOT_OK);
        return true;
      }
      logLength=buffer.getLong();
      log("String_Node_Str" + version + "String_Node_Str"+ logLength);
      if (!slave.hasLog(version)) {
        try {
          logVersionWriting=version;
          tempFile=File.createTempFile("String_Node_Str",Long.toString(version));
          logToWrite=new RandomAccessFile(tempFile,"String_Node_Str").getChannel();
        }
 catch (        IOException e) {
          close();
          throw new SocketException("String_Node_Str" + version + "String_Node_Str",e);
        }
        setStatus(Status.SETUP_OK);
      }
 else {
        log("String_Node_Str" + version + "String_Node_Str");
        setStatus(Status.SETUP_NOT_OK);
      }
      retries=0;
      return true;
    }
 else {
      if (read > 0) {
        connection.pushBackAllReadData();
      }
      return false;
    }
  }
  finally {
    releaseReadBuffer();
  }
}

Fixed version (ground truth):
private boolean getMessage(){
  if (!acquireReadBuffer()) {
    return false;
  }
  try {
    buffer.limit(17);
    int read=connection.read();
    if (read == 17) {
      buffer.flip();
      byte request=buffer.get();
      if (request != HeaderConstants.OFFER_LOG) {
        log("String_Node_Str" + request);
        close();
        return true;
      }
      long version=buffer.getLong();
      if (version < slave.getVersion()) {
        log("String_Node_Str" + version + "String_Node_Str");
        setStatus(Status.SETUP_NOT_OK);
        return true;
      }
      logLength=buffer.getLong();
      log("String_Node_Str" + version + "String_Node_Str"+ logLength);
      if (!slave.hasLog(version)) {
        try {
          logVersionWriting=version;
          tempFile=new File("String_Node_Str" + Long.toString(version));
          logToWrite=new RandomAccessFile(tempFile,"String_Node_Str").getChannel();
          logToWrite.truncate(0);
        }
 catch (        IOException e) {
          close();
          throw new SocketException("String_Node_Str" + version + "String_Node_Str",e);
        }
        setStatus(Status.SETUP_OK);
      }
 else {
        log("String_Node_Str" + version + "String_Node_Str");
        setStatus(Status.SETUP_NOT_OK);
      }
      retries=0;
      return true;
    }
 else {
      if (read > 0) {
        connection.pushBackAllReadData();
      }
      return false;
    }
  }
  finally {
    releaseReadBuffer();
  }
}
Program: 155012
Project: 155012
Buggy source:
public HandleSlaveConnection(Connection connection,Master master,long slaveVersion){
  super(connection,master);
  this.master=master;
  if (master.hasLog(slaveVersion)) {
    logVersionToSend=slaveVersion;
    logLength=master.getLogLength(slaveVersion);
    try {
      logToSend=master.getLog(slaveVersion);
    }
 catch (    IOException e) {
      throw new SocketException("String_Node_Str",e);
    }
  }
  setStatus(Status.GET_MESSAGE);
}

Fixed version (ground truth):
public HandleSlaveConnection(Connection connection,Master master,long slaveVersion){
  super(connection,master);
  this.master=master;
  setStatus(Status.GET_MESSAGE);
}
Program: 155013
Project: 155013
Buggy source:
public synchronized boolean offerLogToSlave(long version){
  if (logLength != -1 || logVersionToSend != -1 || logToSend != null) {
    return false;
  }
  try {
    logToSend=master.getLog(version);
    logLength=master.getLogLength(version);
    logVersionToSend=version;
    return true;
  }
 catch (  IOException e) {
    throw new SocketException("String_Node_Str" + logVersionToSend + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
public synchronized boolean offerLogToSlave(long version){
  if (!getConnection().connected()) {
    System.out.println("String_Node_Str");
    return false;
  }
  if (logLength != -1 || logVersionToSend != -1 || logToSend != null) {
    return true;
  }
  try {
    if (getStatus() == Status.GET_MESSAGE) {
      logToSend=master.getLog(version);
      logLength=master.getLogLength(version);
      logVersionToSend=version;
      setStatus(Status.SETUP_OFFER_LOG);
    }
    return true;
  }
 catch (  IOException e) {
    throw new SocketException("String_Node_Str" + logVersionToSend + "String_Node_Str",e);
  }
}
Program: 155014
Project: 155014
Buggy source:
private synchronized boolean getMessage(){
  if (logVersionToSend > -1 && logLength > -1 && logToSend != null) {
    setStatus(Status.SETUP_OFFER_LOG);
    return true;
  }
  if (!acquireReadBuffer()) {
    return false;
  }
  try {
    buffer.limit(9);
    int read=connection.read();
    if (read == 9) {
      buffer.flip();
      byte request=buffer.get();
      if (request != HeaderConstants.REQUEST_LOG) {
        log("String_Node_Str" + request);
        close();
        return true;
      }
      logVersionToSend=buffer.getLong();
      if (logVersionToSend > master.getVersion()) {
        log("String_Node_Str" + logVersionToSend + "String_Node_Str");
        return true;
      }
      log("String_Node_Str" + logVersionToSend);
      if (master.hasLog(logVersionToSend)) {
        try {
          logToSend=master.getLog(logVersionToSend);
          logLength=master.getLogLength(logVersionToSend);
        }
 catch (        IOException e) {
          close();
          throw new SocketException("String_Node_Str" + logVersionToSend + "String_Node_Str",e);
        }
        setStatus(Status.SETUP_OFFER_LOG);
      }
 else {
        log("String_Node_Str" + logVersionToSend + "String_Node_Str");
        return true;
      }
      retries=0;
      return true;
    }
 else {
      if (read > 0) {
        connection.pushBackAllReadData();
      }
      return false;
    }
  }
  finally {
    releaseReadBuffer();
  }
}

Fixed version (ground truth):
private synchronized boolean getMessage(){
  if (!acquireReadBuffer()) {
    return false;
  }
  try {
    buffer.limit(9);
    int read=connection.read();
    if (read == 9) {
      buffer.flip();
      byte request=buffer.get();
      if (request != HeaderConstants.REQUEST_LOG) {
        log("String_Node_Str" + request);
        close();
        return true;
      }
      logVersionToSend=buffer.getLong();
      if (logVersionToSend > master.getVersion()) {
        log("String_Node_Str" + logVersionToSend + "String_Node_Str");
        return true;
      }
      log("String_Node_Str" + logVersionToSend);
      if (master.hasLog(logVersionToSend)) {
        try {
          logToSend=master.getLog(logVersionToSend);
          logLength=master.getLogLength(logVersionToSend);
        }
 catch (        IOException e) {
          close();
          throw new SocketException("String_Node_Str" + logVersionToSend + "String_Node_Str",e);
        }
        setStatus(Status.SETUP_OFFER_LOG);
      }
 else {
        log("String_Node_Str" + logVersionToSend + "String_Node_Str");
        return true;
      }
      retries=0;
      return true;
    }
 else {
      if (read > 0) {
        connection.pushBackAllReadData();
      }
      return false;
    }
  }
  finally {
    releaseReadBuffer();
  }
}
Program: 155015
Project: 155015
Buggy source:
private boolean sendLog(){
  if (retries > 20) {
    close();
  }
  connection.write();
  log("String_Node_Str" + logVersionToSend);
  if (!buffer.hasRemaining()) {
    buffer.clear();
    try {
      if (logToSend.read(buffer) <= 0) {
        releaseWriteBuffer();
        setStatus(Status.GET_MESSAGE);
        if (master.hasLog(logVersionToSend + 1)) {
          logVersionToSend=logVersionToSend++;
          logLength=master.getLogLength(logVersionToSend);
          logToSend=master.getLog(logVersionToSend);
        }
 else {
          logLength=-1;
          logVersionToSend=-1;
          logToSend=null;
        }
        return true;
      }
      buffer.flip();
    }
 catch (    IOException e) {
      log("String_Node_Str",e);
      close();
      return true;
    }
  }
  retries++;
  return false;
}

Fixed version (ground truth):
private boolean sendLog(){
  if (retries > 20) {
    close();
  }
  connection.write();
  log("String_Node_Str" + logVersionToSend);
  if (!buffer.hasRemaining()) {
    buffer.clear();
    try {
      if (logToSend.read(buffer) <= 0) {
        releaseWriteBuffer();
        setStatus(Status.GET_MESSAGE);
        logLength=-1;
        logVersionToSend=-1;
        logToSend=null;
        return true;
      }
      buffer.flip();
    }
 catch (    IOException e) {
      log("String_Node_Str",e);
      close();
      return true;
    }
  }
  retries++;
  return false;
}
Program: 155016
Project: 155016
Buggy source:
public LogBuffer put(char[] chars) throws IOException {
  if (mappedBuffer == null || (MAPPED_SIZE - mappedBuffer.position()) < (chars.length * 2)) {
    getNewMappedBuffer();
    if (mappedBuffer == null) {
      fallbackBuffer.clear();
      fallbackBuffer.asCharBuffer().put(chars);
      fallbackBuffer.limit(chars.length * 2);
      fileChannel.write(fallbackBuffer,mappedStartPosition);
      mappedStartPosition+=(chars.length * 2);
      return this;
    }
  }
  int oldPos=mappedBuffer.position();
  mappedBuffer.asCharBuffer().put(chars);
  mappedBuffer.position(oldPos + chars.length * 2);
  return this;
}

Fixed version (ground truth):
private void put(char[] chars,int offset) throws IOException {
  int charsToWrite=chars.length - offset;
  if (charsToWrite * 2 > MAPPED_SIZE) {
    charsToWrite=MAPPED_SIZE / 2;
  }
  if (mappedBuffer == null || (MAPPED_SIZE - mappedBuffer.position()) < (charsToWrite * 2)) {
    getNewMappedBuffer();
    if (mappedBuffer == null) {
      int bytesToWrite=(chars.length - offset) * 2;
      ByteBuffer buf=ByteBuffer.allocate(bytesToWrite);
      buf.asCharBuffer().put(chars,offset,chars.length - offset);
      buf.limit(chars.length * 2);
      int count=fileChannel.write(buf,mappedStartPosition);
      if (count != bytesToWrite) {
        throw new UnderlyingStorageException("String_Node_Str" + offset + "String_Node_Str"+ bytesToWrite+ "String_Node_Str"+ count);
      }
      mappedStartPosition+=bytesToWrite;
      return;
    }
  }
  int oldPos=mappedBuffer.position();
  mappedBuffer.asCharBuffer().put(chars,offset,charsToWrite);
  mappedBuffer.position(oldPos + (charsToWrite * 2));
  offset+=charsToWrite;
  if (offset < chars.length) {
    put(chars,offset);
  }
}
Program: 155017
Project: 155017
Buggy source:
public void rotateLogAndPushToSlaves() throws IOException {
  if (slaveList.size() == 0) {
    return;
  }
  ArrayList<HandleSlaveConnection> newList=new ArrayList<HandleSlaveConnection>();
  for (  HandleSlaveConnection slave : slaveList) {
    XaDataSource xaDs=xaDsMgr.getXaDataSource(slave.getXaDsName());
    if (xaDs != null) {
      long version=xaDs.getCurrentLogVersion();
      xaDs.rotateLogicalLog();
      if (!slave.offerLogToSlave(version)) {
        System.out.println("String_Node_Str" + slave);
      }
 else {
        newList.add(slave);
      }
    }
  }
  slaveList=newList;
}

Fixed version (ground truth):
public void rotateLogAndPushToSlaves() throws IOException {
  if (slaveList.size() == 0) {
    return;
  }
  List<HandleSlaveConnection> newList=new CopyOnWriteArrayList<HandleSlaveConnection>();
  for (  HandleSlaveConnection slave : slaveList) {
    XaDataSource xaDs=xaDsMgr.getXaDataSource(slave.getXaDsName());
    if (xaDs != null) {
      long version=xaDs.getCurrentLogVersion();
      xaDs.rotateLogicalLog();
      if (!slave.offerLogToSlave(version)) {
        System.out.println("String_Node_Str" + slave);
      }
 else {
        newList.add(slave);
      }
    }
  }
  slaveList=newList;
}
Program: 155018
Project: 155018
Buggy source:
private boolean getMessage(){
  if (!acquireReadBuffer()) {
    return false;
  }
  try {
    buffer.limit(17);
    int read=connection.read();
    if (read == 17) {
      buffer.flip();
      byte request=buffer.get();
      if (request != HeaderConstants.OFFER_LOG) {
        log("String_Node_Str" + request);
        close();
        return true;
      }
      long version=buffer.getLong();
      if (version < xaDs.getCurrentLogVersion()) {
        log("String_Node_Str" + version + "String_Node_Str");
        setStatus(Status.SETUP_NOT_OK);
        return true;
      }
      logLength=buffer.getLong();
      log("String_Node_Str" + version + "String_Node_Str"+ logLength);
      if (!xaDs.hasLogicalLog(version)) {
        try {
          logVersionWriting=version;
          tempFile=new File("String_Node_Str" + Long.toString(version));
          logToWrite=new RandomAccessFile(tempFile,"String_Node_Str").getChannel();
          logToWrite.truncate(0);
        }
 catch (        IOException e) {
          close();
          throw new SocketException("String_Node_Str" + version + "String_Node_Str",e);
        }
        setStatus(Status.SETUP_OK);
      }
 else {
        log("String_Node_Str" + version + "String_Node_Str");
        setStatus(Status.SETUP_NOT_OK);
      }
      retries=0;
      return true;
    }
 else {
      if (read > 0) {
        connection.pushBackAllReadData();
      }
      return false;
    }
  }
  finally {
    releaseReadBuffer();
  }
}

Fixed version (ground truth):
private boolean getMessage(){
  if (!acquireReadBuffer()) {
    return false;
  }
  try {
    buffer.limit(17);
    int read=connection.read();
    if (read == 17) {
      buffer.flip();
      byte request=buffer.get();
      if (request != HeaderConstants.OFFER_LOG) {
        log("String_Node_Str" + request);
        close();
        return true;
      }
      long version=buffer.getLong();
      if (version < xaDs.getCurrentLogVersion()) {
        log("String_Node_Str" + version + "String_Node_Str");
        setStatus(Status.SETUP_NOT_OK);
        return true;
      }
      logLength=buffer.getLong();
      log("String_Node_Str" + version + "String_Node_Str"+ logLength);
      if (!xaDs.hasLogicalLog(version)) {
        try {
          logVersionWriting=version;
          tempFile=new File(xaDs.getName() + "String_Node_Str" + Long.toString(version));
          if (tempFile.exists()) {
            log(tempFile.getName() + "String_Node_Str");
            tempFile.delete();
          }
          logToWrite=new RandomAccessFile(tempFile,"String_Node_Str").getChannel();
          logToWrite.truncate(0);
        }
 catch (        IOException e) {
          close();
          throw new SocketException("String_Node_Str" + version + "String_Node_Str",e);
        }
        setStatus(Status.SETUP_OK);
      }
 else {
        log("String_Node_Str" + version + "String_Node_Str");
        setStatus(Status.SETUP_NOT_OK);
      }
      retries=0;
      return true;
    }
 else {
      if (read > 0) {
        connection.pushBackAllReadData();
      }
      return false;
    }
  }
  finally {
    releaseReadBuffer();
  }
}
Program: 155019
Project: 155019
Buggy source:
public HandleSlaveConnection(Connection connection,Master master,long slaveVersion,String xaDsName){
  super(connection,master);
  this.master=master;
  this.xaDsName=xaDsName;
  setStatus(Status.GET_MESSAGE);
}

Fixed version (ground truth):
public HandleSlaveConnection(Connection connection,Master master,long slaveVersion,String xaDsName){
  super(connection,master);
  this.master=master;
  this.xaDsName=xaDsName;
  this.slaveVersion=slaveVersion;
  setStatus(Status.GET_MESSAGE);
}
Program: 155020
Project: 155020
Buggy source:
private boolean sendLog(){
  if (retries > 20) {
    close();
  }
  connection.write();
  log("String_Node_Str" + logVersionToSend);
  if (!buffer.hasRemaining()) {
    buffer.clear();
    try {
      if (logToSend.read(buffer) <= 0) {
        releaseWriteBuffer();
        setStatus(Status.GET_MESSAGE);
        logLength=-1;
        logVersionToSend=-1;
        logToSend=null;
        return true;
      }
      buffer.flip();
    }
 catch (    IOException e) {
      log("String_Node_Str",e);
      close();
      return true;
    }
  }
  retries++;
  return false;
}

Fixed version (ground truth):
private boolean sendLog(){
  if (retries > 20) {
    close();
  }
  connection.write();
  log("String_Node_Str" + logVersionToSend);
  if (!buffer.hasRemaining()) {
    buffer.clear();
    try {
      if (logToSend.read(buffer) <= 0) {
        releaseWriteBuffer();
        setStatus(Status.GET_MESSAGE);
        logLength=-1;
        logVersionToSend=-1;
        logToSend=null;
        if (logVersionToSend >= slaveVersion) {
          slaveVersion=logVersionToSend + 1;
        }
        return true;
      }
      buffer.flip();
    }
 catch (    IOException e) {
      log("String_Node_Str",e);
      close();
      return true;
    }
  }
  retries++;
  return false;
}
Program: 155021
Project: 155021
Buggy source:
private boolean sendGreeting(){
  if (retries > 20) {
    close();
  }
  log("String_Node_Str");
  connection.write();
  if (!buffer.hasRemaining()) {
    releaseWriteBuffer();
    setNoRequeue();
    setChainJob(new HandleSlaveConnection(connection,master,slaveVersion,xaDsName));
    return true;
  }
  retries++;
  return false;
}

Fixed version (ground truth):
private boolean sendGreeting(){
  if (retries > 20) {
    close();
  }
  log("String_Node_Str");
  connection.write();
  if (!buffer.hasRemaining()) {
    releaseWriteBuffer();
    setNoRequeue();
    setChainJob(new HandleSlaveConnection(connection,master,xaDsName));
    return true;
  }
  retries++;
  return false;
}
Program: 155023
Project: 155023
Buggy source:
public HandleSlaveConnection(Connection connection,Master master,long slaveVersion,String xaDsName){
  super(connection,master);
  this.master=master;
  this.xaDsName=xaDsName;
  this.slaveVersion=slaveVersion;
  setStatus(Status.GET_MESSAGE);
}

Fixed version (ground truth):
public HandleSlaveConnection(Connection connection,Master master,String xaDsName){
  super(connection,master);
  this.master=master;
  this.xaDsName=xaDsName;
  setStatus(Status.GET_MESSAGE);
}
Program: 155024
Project: 155024
Buggy source:
private boolean sendLog(){
  if (retries > 20) {
    close();
  }
  connection.write();
  log("String_Node_Str" + logVersionToSend);
  if (!buffer.hasRemaining()) {
    buffer.clear();
    try {
      if (logToSend.read(buffer) <= 0) {
        releaseWriteBuffer();
        setStatus(Status.GET_MESSAGE);
        logLength=-1;
        logVersionToSend=-1;
        logToSend=null;
        if (logVersionToSend >= slaveVersion) {
          slaveVersion=logVersionToSend + 1;
        }
        return true;
      }
      buffer.flip();
    }
 catch (    IOException e) {
      log("String_Node_Str",e);
      close();
      return true;
    }
  }
  retries++;
  return false;
}

Fixed version (ground truth):
private boolean sendLog(){
  if (retries > 20) {
    close();
  }
  connection.write();
  log("String_Node_Str" + logVersionToSend);
  if (!buffer.hasRemaining()) {
    buffer.clear();
    try {
      if (logToSend.read(buffer) <= 0) {
        releaseWriteBuffer();
        if (nextLogVersion != -1) {
          logToSend=master.getLog(xaDsName,nextLogVersion);
          logLength=master.getLogLength(xaDsName,nextLogVersion);
          logVersionToSend=nextLogVersion;
          nextLogVersion=-1;
          setStatus(Status.SETUP_OFFER_LOG);
        }
 else {
          setStatus(Status.GET_MESSAGE);
        }
        logLength=-1;
        logVersionToSend=-1;
        logToSend=null;
        return true;
      }
      buffer.flip();
    }
 catch (    IOException e) {
      log("String_Node_Str",e);
      close();
      return true;
    }
  }
  retries++;
  return false;
}
Program: 155025
Project: 155025
Buggy source:
public void rotateLogAndPushToSlaves() throws IOException {
  if (slaveList.size() == 0) {
    return;
  }
  List<HandleSlaveConnection> newList=new CopyOnWriteArrayList<HandleSlaveConnection>();
  for (  HandleSlaveConnection slave : slaveList) {
    XaDataSource xaDs=xaDsMgr.getXaDataSource(slave.getXaDsName());
    if (xaDs != null) {
      long version=xaDs.getCurrentLogVersion();
      xaDs.rotateLogicalLog();
      if (!slave.offerLogToSlave(version)) {
        System.out.println("String_Node_Str" + slave);
      }
 else {
        newList.add(slave);
      }
    }
  }
  slaveList=newList;
}

Fixed version (ground truth):
public synchronized void rotateLogAndPushToSlaves() throws IOException {
  if (slaveList.size() == 0) {
    return;
  }
  for (  XaDataSource xaDs : xaDsMgr.getAllRegisteredDataSources()) {
    xaDs.rotateLogicalLog();
  }
  List<HandleSlaveConnection> newList=new CopyOnWriteArrayList<HandleSlaveConnection>();
  for (  HandleSlaveConnection slave : slaveList) {
    XaDataSource xaDs=xaDsMgr.getXaDataSource(slave.getXaDsName());
    if (xaDs != null) {
      long version=xaDs.getCurrentLogVersion() - 1;
      if (!slave.offerLogToSlave(version)) {
        System.out.println("String_Node_Str" + slave);
      }
 else {
        newList.add(slave);
      }
    }
  }
  slaveList=newList;
}
Program: 155026
Project: 155026
Buggy source:
@Override @SuppressWarnings("String_Node_Str") protected void setupBackup(EmbeddedGraphDatabase neo,String location) throws IOException {
  Backup backupComp=new Neo4jBackup(neo,location,new ArrayList<String>(){
{
      add("String_Node_Str");
      add("String_Node_Str");
    }
  }
);
  backupComp.doBackup();
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") protected void setupBackup(EmbeddedGraphDatabase graphDb,String location) throws IOException {
  Backup backupComp=new Neo4jBackup(graphDb,location,new ArrayList<String>(){
{
      add("String_Node_Str");
      add("String_Node_Str");
    }
  }
);
  backupComp.doBackup();
}
Program: 155027
Project: 155027
Buggy source:
@Test public void backup() throws IOException {
  System.out.println("String_Node_Str");
  EmbeddedGraphDatabase neo=Util.startNeoInstance(STORE_LOCATION_DIR);
  ((NeoStoreXaDataSource)neo.getConfig().getPersistenceModule().getPersistenceManager().getPersistenceSource().getXaDataSource()).keepLogicalLogs(true);
  IndexService indexService=new LuceneIndexService(neo);
  XaDataSourceManager xaDsm=neo.getConfig().getTxModule().getXaDataSourceManager();
  XaDataSource ds=xaDsm.getXaDataSource("String_Node_Str");
  ((LuceneDataSource)ds).keepLogicalLogs(true);
  System.out.println("String_Node_Str");
  tryBackup(neo,BACKUP_LOCATION_DIR,1);
  Transaction tx=neo.beginTx();
  try {
    indexService.index(addNode(neo),"String_Node_Str",2);
    tx.success();
  }
  finally {
    tx.finish();
  }
  System.out.println("String_Node_Str");
  tryBackup(neo,BACKUP_LOCATION_DIR,2);
  tx=neo.beginTx();
  try {
    indexService.index(addNode(neo),"String_Node_Str",3);
    tx.success();
  }
  finally {
    tx.finish();
  }
  System.out.println("String_Node_Str");
  tx=neo.beginTx();
  try {
    indexService.index(addNode(neo),"String_Node_Str",4);
    System.out.println("String_Node_Str");
    tryBackup(neo,BACKUP_LOCATION_DIR,3);
    tx.success();
  }
  finally {
    tx.finish();
  }
  System.out.println("String_Node_Str");
  tryBackup(neo,BACKUP_LOCATION_DIR,4);
  Util.stopNeo(neo,indexService);
}

Fixed version (ground truth):
@Test public void backup() throws IOException {
  System.out.println("String_Node_Str");
  EmbeddedGraphDatabase graphDb=Util.startGraphDbInstance(STORE_LOCATION_DIR);
  ((NeoStoreXaDataSource)graphDb.getConfig().getPersistenceModule().getPersistenceManager().getPersistenceSource().getXaDataSource()).keepLogicalLogs(true);
  IndexService indexService=new LuceneIndexService(graphDb);
  XaDataSourceManager xaDsm=graphDb.getConfig().getTxModule().getXaDataSourceManager();
  XaDataSource ds=xaDsm.getXaDataSource("String_Node_Str");
  ((LuceneDataSource)ds).keepLogicalLogs(true);
  System.out.println("String_Node_Str");
  tryBackup(graphDb,BACKUP_LOCATION_DIR,1);
  Transaction tx=graphDb.beginTx();
  try {
    indexService.index(addNode(graphDb),"String_Node_Str",2);
    tx.success();
  }
  finally {
    tx.finish();
  }
  System.out.println("String_Node_Str");
  tryBackup(graphDb,BACKUP_LOCATION_DIR,2);
  tx=graphDb.beginTx();
  try {
    indexService.index(addNode(graphDb),"String_Node_Str",3);
    tx.success();
  }
  finally {
    tx.finish();
  }
  System.out.println("String_Node_Str");
  tx=graphDb.beginTx();
  try {
    indexService.index(addNode(graphDb),"String_Node_Str",4);
    System.out.println("String_Node_Str");
    tryBackup(graphDb,BACKUP_LOCATION_DIR,3);
    tx.success();
  }
  finally {
    tx.finish();
  }
  System.out.println("String_Node_Str");
  tryBackup(graphDb,BACKUP_LOCATION_DIR,4);
  Util.stopGraphDb(graphDb,indexService);
}
Program: 155028
Project: 155028
Buggy source:
protected void tryBackup(EmbeddedGraphDatabase neo,String location,int relCount) throws IOException {
  setupBackup(neo,location);
  EmbeddedGraphDatabase bNeo=Util.startNeoInstance(location);
  IndexService bIndexService=new LuceneIndexService(bNeo);
  Transaction bTx=bNeo.beginTx();
  try {
    List<Relationship> rels=new ArrayList<Relationship>();
    for (    Relationship rel : bNeo.getReferenceNode().getRelationships()) {
      rels.add(rel);
    }
    assertEquals(relCount,rels.size());
    Node node=bIndexService.getSingleNode("String_Node_Str",relCount);
    assertEquals(true,node != null);
    assertEquals(node.getId(),(long)(Long)node.getProperty("String_Node_Str",-1L));
    bTx.success();
  }
  finally {
    bTx.finish();
  }
  Util.stopNeo(bNeo,bIndexService);
}

Fixed version (ground truth):
protected void tryBackup(EmbeddedGraphDatabase graphDb,String location,int relCount) throws IOException {
  setupBackup(graphDb,location);
  EmbeddedGraphDatabase bDb=Util.startGraphDbInstance(location);
  IndexService bIndexService=new LuceneIndexService(bDb);
  Transaction bTx=bDb.beginTx();
  try {
    List<Relationship> rels=new ArrayList<Relationship>();
    for (    Relationship rel : bDb.getReferenceNode().getRelationships()) {
      rels.add(rel);
    }
    assertEquals(relCount,rels.size());
    Node node=bIndexService.getSingleNode("String_Node_Str",relCount);
    assertEquals(true,node != null);
    assertEquals(node.getId(),(long)(Long)node.getProperty("String_Node_Str",-1L));
    bTx.success();
  }
  finally {
    bTx.finish();
  }
  Util.stopGraphDb(bDb,bIndexService);
}
Program: 155029
Project: 155029
Buggy source:
private Node addNode(EmbeddedGraphDatabase neo){
  Node referenceNode=neo.getReferenceNode();
  Node node=neo.createNode();
  node.setProperty("String_Node_Str",node.getId());
  referenceNode.createRelationshipTo(node,MyRels.TEST);
  return node;
}

Fixed version (ground truth):
private Node addNode(EmbeddedGraphDatabase graphDb){
  Node referenceNode=graphDb.getReferenceNode();
  Node node=graphDb.createNode();
  node.setProperty("String_Node_Str",node.getId());
  referenceNode.createRelationshipTo(node,MyRels.TEST);
  return node;
}
Program: 155030
Project: 155030
Buggy source:
@Before public void setup(){
  Util.deleteDir(new File(VAR));
  System.out.println("String_Node_Str");
  EmbeddedGraphDatabase neo=Util.startNeoInstance(STORE_LOCATION_DIR);
  XaDataSource neoStoreXaDataSource=neo.getConfig().getPersistenceModule().getPersistenceManager().getPersistenceSource().getXaDataSource();
  neoStoreXaDataSource.keepLogicalLogs(true);
  IndexService indexService=new LuceneIndexService(neo);
  XaDataSourceManager xaDsm=neo.getConfig().getTxModule().getXaDataSourceManager();
  XaDataSource ds=xaDsm.getXaDataSource("String_Node_Str");
  ((LuceneDataSource)ds).keepLogicalLogs(true);
  Transaction tx=neo.beginTx();
  try {
    indexService.index(addNode(neo),"String_Node_Str",1);
    tx.success();
  }
  finally {
    tx.finish();
  }
  Util.stopNeo(neo,indexService);
  Util.copyDir(STORE_LOCATION_DIR,BACKUP_LOCATION_DIR);
}

Fixed version (ground truth):
@Before public void setup(){
  Util.deleteDir(new File(VAR));
  System.out.println("String_Node_Str");
  EmbeddedGraphDatabase graphDb=Util.startGraphDbInstance(STORE_LOCATION_DIR);
  XaDataSource neoStoreXaDataSource=graphDb.getConfig().getPersistenceModule().getPersistenceManager().getPersistenceSource().getXaDataSource();
  neoStoreXaDataSource.keepLogicalLogs(true);
  IndexService indexService=new LuceneIndexService(graphDb);
  XaDataSourceManager xaDsm=graphDb.getConfig().getTxModule().getXaDataSourceManager();
  XaDataSource ds=xaDsm.getXaDataSource("String_Node_Str");
  ((LuceneDataSource)ds).keepLogicalLogs(true);
  Transaction tx=graphDb.beginTx();
  try {
    indexService.index(addNode(graphDb),"String_Node_Str",1);
    tx.success();
  }
  finally {
    tx.finish();
  }
  Util.stopGraphDb(graphDb,indexService);
  Util.copyDir(STORE_LOCATION_DIR,BACKUP_LOCATION_DIR);
}
Program: 155031
Project: 155031
Buggy source:
@SuppressWarnings("String_Node_Str") protected void setupBackup(EmbeddedGraphDatabase neo,String location) throws IOException {
  EmbeddedGraphDatabase bNeo=Util.startNeoInstance(location);
  IndexService bIndexService=new LuceneIndexService(bNeo);
  Backup backupComp=new Neo4jBackup(neo,bNeo,new ArrayList<String>(){
{
      add("String_Node_Str");
      add("String_Node_Str");
    }
  }
);
  backupComp.enableFileLogger();
  backupComp.doBackup();
  Util.stopNeo(bNeo,bIndexService);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected void setupBackup(EmbeddedGraphDatabase graphDb,String location) throws IOException {
  EmbeddedGraphDatabase bDb=Util.startGraphDbInstance(location);
  IndexService bIndexService=new LuceneIndexService(bDb);
  Backup backupComp=new Neo4jBackup(graphDb,bDb,new ArrayList<String>(){
{
      add("String_Node_Str");
      add("String_Node_Str");
    }
  }
);
  backupComp.enableFileLogger();
  backupComp.doBackup();
  Util.stopGraphDb(bDb,bIndexService);
}
Program: 155032
Project: 155032
Buggy source:
@Override protected void tryBackup(EmbeddedGraphDatabase neo,String location,int relCount) throws IOException {
  System.out.println("String_Node_Str");
  Backup backupComp=new Neo4jBackup(neo,location);
  backupComp.doBackup();
  EmbeddedGraphDatabase bNeo=Util.startNeoInstance(location);
  Transaction bTx=bNeo.beginTx();
  try {
    List<Relationship> rels=new ArrayList<Relationship>();
    for (    Relationship rel : bNeo.getReferenceNode().getRelationships()) {
      rels.add(rel);
    }
    assertEquals(relCount,rels.size());
    bTx.success();
  }
  finally {
    bTx.finish();
  }
  Util.stopNeo(bNeo);
}

Fixed version (ground truth):
@Override protected void tryBackup(EmbeddedGraphDatabase graphDb,String location,int relCount) throws IOException {
  System.out.println("String_Node_Str");
  Backup backupComp=new Neo4jBackup(graphDb,location);
  backupComp.doBackup();
  EmbeddedGraphDatabase bDb=Util.startGraphDbInstance(location);
  Transaction bTx=bDb.beginTx();
  try {
    List<Relationship> rels=new ArrayList<Relationship>();
    for (    Relationship rel : bDb.getReferenceNode().getRelationships()) {
      rels.add(rel);
    }
    assertEquals(relCount,rels.size());
    bTx.success();
  }
  finally {
    bTx.finish();
  }
  Util.stopGraphDb(bDb);
}
Program: 155033
Project: 155033
Buggy source:
@Test public void backup() throws IOException {
  EmbeddedGraphDatabase neo=Util.startNeoInstance(STORE_LOCATION_DIR);
  ((NeoStoreXaDataSource)neo.getConfig().getPersistenceModule().getPersistenceManager().getPersistenceSource().getXaDataSource()).keepLogicalLogs(true);
  System.out.println("String_Node_Str");
  tryBackup(neo,BACKUP_LOCATION_DIR,1);
  Transaction tx=neo.beginTx();
  try {
    addNode(neo);
    tx.success();
  }
  finally {
    tx.finish();
  }
  System.out.println("String_Node_Str");
  tryBackup(neo,BACKUP_LOCATION_DIR,2);
  tx=neo.beginTx();
  try {
    addNode(neo);
    tx.success();
  }
  finally {
    tx.finish();
  }
  System.out.println("String_Node_Str");
  tx=neo.beginTx();
  try {
    addNode(neo);
    System.out.println("String_Node_Str");
    tryBackup(neo,BACKUP_LOCATION_DIR,3);
    tx.success();
  }
  finally {
    tx.finish();
  }
  System.out.println("String_Node_Str");
  tryBackup(neo,BACKUP_LOCATION_DIR,4);
  Util.stopNeo(neo);
}

Fixed version (ground truth):
@Test public void backup() throws IOException {
  EmbeddedGraphDatabase graphDb=Util.startGraphDbInstance(STORE_LOCATION_DIR);
  ((NeoStoreXaDataSource)graphDb.getConfig().getPersistenceModule().getPersistenceManager().getPersistenceSource().getXaDataSource()).keepLogicalLogs(true);
  System.out.println("String_Node_Str");
  tryBackup(graphDb,BACKUP_LOCATION_DIR,1);
  Transaction tx=graphDb.beginTx();
  try {
    addNode(graphDb);
    tx.success();
  }
  finally {
    tx.finish();
  }
  System.out.println("String_Node_Str");
  tryBackup(graphDb,BACKUP_LOCATION_DIR,2);
  tx=graphDb.beginTx();
  try {
    addNode(graphDb);
    tx.success();
  }
  finally {
    tx.finish();
  }
  System.out.println("String_Node_Str");
  tx=graphDb.beginTx();
  try {
    addNode(graphDb);
    System.out.println("String_Node_Str");
    tryBackup(graphDb,BACKUP_LOCATION_DIR,3);
    tx.success();
  }
  finally {
    tx.finish();
  }
  System.out.println("String_Node_Str");
  tryBackup(graphDb,BACKUP_LOCATION_DIR,4);
  Util.stopGraphDb(graphDb);
}
Program: 155034
Project: 155034
Buggy source:
protected void tryBackup(EmbeddedGraphDatabase neo,String location,int relCount) throws IOException {
  System.out.println("String_Node_Str");
  EmbeddedGraphDatabase bNeo=Util.startNeoInstance(location);
  Backup backupComp=new Neo4jBackup(neo,bNeo);
  backupComp.enableFileLogger();
  backupComp.doBackup();
  Util.stopNeo(bNeo);
  bNeo=Util.startNeoInstance(location);
  Transaction bTx=bNeo.beginTx();
  try {
    List<Relationship> rels=new ArrayList<Relationship>();
    for (    Relationship rel : bNeo.getReferenceNode().getRelationships()) {
      rels.add(rel);
    }
    assertEquals(relCount,rels.size());
    bTx.success();
  }
  finally {
    bTx.finish();
  }
  Util.stopNeo(bNeo);
}

Fixed version (ground truth):
protected void tryBackup(EmbeddedGraphDatabase graphDb,String location,int relCount) throws IOException {
  System.out.println("String_Node_Str");
  EmbeddedGraphDatabase bDb=Util.startGraphDbInstance(location);
  Backup backupComp=new Neo4jBackup(graphDb,bDb);
  backupComp.enableFileLogger();
  backupComp.doBackup();
  Util.stopGraphDb(bDb);
  bDb=Util.startGraphDbInstance(location);
  Transaction bTx=bDb.beginTx();
  try {
    List<Relationship> rels=new ArrayList<Relationship>();
    for (    Relationship rel : bDb.getReferenceNode().getRelationships()) {
      rels.add(rel);
    }
    assertEquals(relCount,rels.size());
    bTx.success();
  }
  finally {
    bTx.finish();
  }
  Util.stopGraphDb(bDb);
}
Program: 155035
Project: 155035
Buggy source:
private void addNode(EmbeddedGraphDatabase neo){
  Node referenceNode=neo.getReferenceNode();
  Node node=neo.createNode();
  referenceNode.createRelationshipTo(node,MyRels.TEST);
}

Fixed version (ground truth):
private void addNode(EmbeddedGraphDatabase graphDb){
  Node referenceNode=graphDb.getReferenceNode();
  Node node=graphDb.createNode();
  referenceNode.createRelationshipTo(node,MyRels.TEST);
}
Program: 155036
Project: 155036
Buggy source:
@Before public void clean(){
  Util.deleteDir(new File(VAR));
  System.out.println("String_Node_Str");
  EmbeddedGraphDatabase neo=Util.startNeoInstance(STORE_LOCATION_DIR);
  ((NeoStoreXaDataSource)neo.getConfig().getPersistenceModule().getPersistenceManager().getPersistenceSource().getXaDataSource()).keepLogicalLogs(true);
  Transaction tx=neo.beginTx();
  try {
    addNode(neo);
    tx.success();
  }
  finally {
    tx.finish();
  }
  Util.stopNeo(neo);
  Util.copyDir(STORE_LOCATION_DIR,BACKUP_LOCATION_DIR);
}

Fixed version (ground truth):
@Before public void clean(){
  Util.deleteDir(new File(VAR));
  System.out.println("String_Node_Str");
  EmbeddedGraphDatabase graphDb=Util.startGraphDbInstance(STORE_LOCATION_DIR);
  ((NeoStoreXaDataSource)graphDb.getConfig().getPersistenceModule().getPersistenceManager().getPersistenceSource().getXaDataSource()).keepLogicalLogs(true);
  Transaction tx=graphDb.beginTx();
  try {
    addNode(graphDb);
    tx.success();
  }
  finally {
    tx.finish();
  }
  Util.stopGraphDb(graphDb);
  Util.copyDir(STORE_LOCATION_DIR,BACKUP_LOCATION_DIR);
}
Program: 155037
Project: 155037
Buggy source:
/** 
 * @param graphDb the {@link GraphDatabaseService} instance to use with theshell server.
 * @throws RemoteException if an RMI error occurs.
 */
public GraphDatabaseShellServer(GraphDatabaseService graphDb) throws RemoteException {
  super();
  addNeoApps();
  this.graphDb=graphDb;
  this.bashInterpreter=new BashVariableInterpreter();
  this.bashInterpreter.addReplacer("String_Node_Str",new WorkingDirReplacer());
  this.setProperty(AbstractClient.PROMPT_KEY,getShellPrompt());
  this.setProperty(AbstractClient.TITLE_KEYS_KEY,"String_Node_Str");
  this.setProperty(AbstractClient.TITLE_MAX_LENGTH,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param graphDb the {@link GraphDatabaseService} instance to use with theshell server.
 * @throws RemoteException if an RMI error occurs.
 */
public GraphDatabaseShellServer(GraphDatabaseService graphDb) throws RemoteException {
  super();
  addGraphDbApps();
  this.graphDb=graphDb;
  this.bashInterpreter=new BashVariableInterpreter();
  this.bashInterpreter.addReplacer("String_Node_Str",new WorkingDirReplacer());
  this.setProperty(AbstractClient.PROMPT_KEY,getShellPrompt());
  this.setProperty(AbstractClient.TITLE_KEYS_KEY,"String_Node_Str");
  this.setProperty(AbstractClient.TITLE_MAX_LENGTH,"String_Node_Str");
}
Program: 155038
Project: 155038
Buggy source:
/** 
 * Constructs a new application which can create relationships in neo.
 */
public Mkrel(){
  this.addValueType("String_Node_Str",new OptionContext(OptionValueType.MUST,"String_Node_Str"));
  this.addValueType("String_Node_Str",new OptionContext(OptionValueType.MUST,"String_Node_Str"));
  this.addValueType("String_Node_Str",new OptionContext(OptionValueType.MUST,"String_Node_Str" + this.directionAlternatives() + "String_Node_Str"));
  this.addValueType("String_Node_Str",new OptionContext(OptionValueType.NONE,"String_Node_Str"));
  this.addValueType("String_Node_Str",new OptionContext(OptionValueType.NONE,"String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Constructs a new application which can create relationships in Neo4j.
 */
public Mkrel(){
  this.addValueType("String_Node_Str",new OptionContext(OptionValueType.MUST,"String_Node_Str"));
  this.addValueType("String_Node_Str",new OptionContext(OptionValueType.MUST,"String_Node_Str"));
  this.addValueType("String_Node_Str",new OptionContext(OptionValueType.MUST,"String_Node_Str" + this.directionAlternatives() + "String_Node_Str"));
  this.addValueType("String_Node_Str",new OptionContext(OptionValueType.NONE,"String_Node_Str"));
  this.addValueType("String_Node_Str",new OptionContext(OptionValueType.NONE,"String_Node_Str"));
}
Program: 155039
Project: 155039
Buggy source:
/** 
 * Constructs a new application which can delete relationships in neo.
 */
public Rmrel(){
  this.addValueType("String_Node_Str",new OptionContext(OptionValueType.NONE,"String_Node_Str" + "String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Constructs a new application which can delete relationships in Neo4j.
 */
public Rmrel(){
  this.addValueType("String_Node_Str",new OptionContext(OptionValueType.NONE,"String_Node_Str" + "String_Node_Str"));
}
Program: 155040
Project: 155040
Buggy source:
BasicConnection(BasicGraphDatabaseServer server,GraphDatabaseService neo){
  this.server=server;
  this.neo=neo;
}

Fixed version (ground truth):
BasicConnection(BasicGraphDatabaseServer server,GraphDatabaseService graphDb){
  this.server=server;
  this.graphDb=graphDb;
}
Program: 155041
Project: 155041
Buggy source:
ResponseBuilder response(){
  ResponseBuilder builder=new ResponseBuilder();
  server.buildResponse(neo,builder);
  return builder;
}

Fixed version (ground truth):
ResponseBuilder response(){
  ResponseBuilder builder=new ResponseBuilder();
  server.buildResponse(graphDb,builder);
  return builder;
}
Program: 155042
Project: 155042
Buggy source:
long createNode(GraphDatabaseService neo){
  return neo.createNode().getId();
}

Fixed version (ground truth):
long createNode(GraphDatabaseService graphDb){
  return graphDb.createNode().getId();
}
Program: 155043
Project: 155043
Buggy source:
public long getTotalNumberOfNodes(GraphDatabaseService neo){
  if (neo instanceof EmbeddedGraphDatabase) {
    EmbeddedGraphDatabase embedded=(EmbeddedGraphDatabase)neo;
    return embedded.getConfig().getNeoModule().getNodeManager().getNumberOfIdsInUse(Node.class);
  }
 else {
    return -1;
  }
}

Fixed version (ground truth):
public long getTotalNumberOfNodes(GraphDatabaseService graphDb){
  if (graphDb instanceof EmbeddedGraphDatabase) {
    EmbeddedGraphDatabase embedded=(EmbeddedGraphDatabase)graphDb;
    return embedded.getConfig().getNeoModule().getNodeManager().getNumberOfIdsInUse(Node.class);
  }
 else {
    return -1;
  }
}
Program: 155044
Project: 155044
Buggy source:
long createRelationship(GraphDatabaseService neo,String relationshipTypeName,long startNodeId,long endNodeId){
  return neo.getNodeById(startNodeId).createRelationshipTo(neo.getNodeById(endNodeId),new RelType(relationshipTypeName)).getId();
}

Fixed version (ground truth):
long createRelationship(GraphDatabaseService graphDb,String relationshipTypeName,long startNodeId,long endNodeId){
  return graphDb.getNodeById(startNodeId).createRelationshipTo(graphDb.getNodeById(endNodeId),new RelType(relationshipTypeName)).getId();
}
Program: 155045
Project: 155045
Buggy source:
boolean hasNodeWithId(GraphDatabaseService neo,long nodeId){
  Node node=null;
  try {
    node=neo.getNodeById(nodeId);
  }
 catch (  Exception ex) {
  }
  ;
  return node != null;
}

Fixed version (ground truth):
boolean hasNodeWithId(GraphDatabaseService graphDb,long nodeId){
  Node node=null;
  try {
    node=graphDb.getNodeById(nodeId);
  }
 catch (  Exception ex) {
  }
  ;
  return node != null;
}
Program: 155046
Project: 155046
Buggy source:
SimpleIterator<RelationshipSpecification> getRelationships(GraphDatabaseService neo,final long nodeId,final Direction direction,String[] relationshipTypeNames){
  RelationshipType[] types=new RelationshipType[relationshipTypeNames.length];
  for (int i=0; i < types.length; i++) {
    types[i]=new RelType(relationshipTypeNames[i]);
  }
  final Iterator<Relationship> relationships=neo.getNodeById(nodeId).getRelationships(types).iterator();
  return new SimpleIterator<RelationshipSpecification>(){
    Relationship next=null;
    @Override boolean hasNext(){
      while (next == null && relationships.hasNext()) {
        Relationship candidate=relationships.next();
switch (direction) {
case OUTGOING:
          if (candidate.getStartNode().getId() == nodeId) {
            next=candidate;
            return true;
          }
        break;
case INCOMING:
      if (candidate.getEndNode().getId() == nodeId) {
        next=candidate;
        return true;
      }
    break;
case BOTH:
  next=candidate;
return true;
default :
throw new IllegalArgumentException();
}
}
return next != null;
}
@Override RelationshipSpecification getNext(){
try {
return new RelationshipSpecification(next);
}
  finally {
next=null;
}
}
}
;
}

Fixed version (ground truth):
SimpleIterator<RelationshipSpecification> getRelationships(GraphDatabaseService graphDb,final long nodeId,final Direction direction,String[] relationshipTypeNames){
  RelationshipType[] types=new RelationshipType[relationshipTypeNames.length];
  for (int i=0; i < types.length; i++) {
    types[i]=new RelType(relationshipTypeNames[i]);
  }
  final Iterator<Relationship> relationships=graphDb.getNodeById(nodeId).getRelationships(types).iterator();
  return new SimpleIterator<RelationshipSpecification>(){
    Relationship next=null;
    @Override boolean hasNext(){
      while (next == null && relationships.hasNext()) {
        Relationship candidate=relationships.next();
switch (direction) {
case OUTGOING:
          if (candidate.getStartNode().getId() == nodeId) {
            next=candidate;
            return true;
          }
        break;
case INCOMING:
      if (candidate.getEndNode().getId() == nodeId) {
        next=candidate;
        return true;
      }
    break;
case BOTH:
  next=candidate;
return true;
default :
throw new IllegalArgumentException();
}
}
return next != null;
}
@Override RelationshipSpecification getNext(){
try {
return new RelationshipSpecification(next);
}
  finally {
next=null;
}
}
}
;
}
Program: 155047
Project: 155047
Buggy source:
SimpleIterator<NodeSpecification> getAllNodes(GraphDatabaseService neo){
  final Iterator<Node> nodes=neo.getAllNodes().iterator();
  return new SimpleIterator<NodeSpecification>(){
    @Override boolean hasNext(){
      return nodes.hasNext();
    }
    @Override NodeSpecification getNext(){
      return new NodeSpecification(nodes.next().getId());
    }
  }
;
}

Fixed version (ground truth):
SimpleIterator<NodeSpecification> getAllNodes(GraphDatabaseService graphDb){
  final Iterator<Node> nodes=graphDb.getAllNodes().iterator();
  return new SimpleIterator<NodeSpecification>(){
    @Override boolean hasNext(){
      return nodes.hasNext();
    }
    @Override NodeSpecification getNext(){
      return new NodeSpecification(nodes.next().getId());
    }
  }
;
}
Program: 155048
Project: 155048
Buggy source:
Object removeNodeProperty(GraphDatabaseService neo,long nodeId,String key){
  return neo.getNodeById(nodeId).removeProperty(key);
}

Fixed version (ground truth):
Object removeNodeProperty(GraphDatabaseService graphDb,long nodeId,String key){
  return graphDb.getNodeById(nodeId).removeProperty(key);
}
Program: 155049
Project: 155049
Buggy source:
SimpleIterator<RelationshipSpecification> getAllRelationships(GraphDatabaseService neo,long nodeId,Direction direction){
  final Iterator<Relationship> relationships=neo.getNodeById(nodeId).getRelationships(direction).iterator();
  return new SimpleIterator<RelationshipSpecification>(){
    @Override boolean hasNext(){
      return relationships.hasNext();
    }
    @Override RelationshipSpecification getNext(){
      return new RelationshipSpecification(relationships.next());
    }
  }
;
}

Fixed version (ground truth):
SimpleIterator<RelationshipSpecification> getAllRelationships(GraphDatabaseService graphDb,long nodeId,Direction direction){
  final Iterator<Relationship> relationships=graphDb.getNodeById(nodeId).getRelationships(direction).iterator();
  return new SimpleIterator<RelationshipSpecification>(){
    @Override boolean hasNext(){
      return relationships.hasNext();
    }
    @Override RelationshipSpecification getNext(){
      return new RelationshipSpecification(relationships.next());
    }
  }
;
}
Program: 155050
Project: 155050
Buggy source:
Object getRelationshipProperty(GraphDatabaseService neo,long relationshipId,String key){
  return neo.getRelationshipById(relationshipId).getProperty(key,null);
}

Fixed version (ground truth):
Object getRelationshipProperty(GraphDatabaseService graphDb,long relationshipId,String key){
  return graphDb.getRelationshipById(relationshipId).getProperty(key,null);
}
Program: 155051
Project: 155051
Buggy source:
boolean hasNodeProperty(GraphDatabaseService neo,long nodeId,String key){
  return neo.getNodeById(nodeId).hasProperty(key);
}

Fixed version (ground truth):
boolean hasNodeProperty(GraphDatabaseService graphDb,long nodeId,String key){
  return graphDb.getNodeById(nodeId).hasProperty(key);
}
Program: 155052
Project: 155052
Buggy source:
boolean hasRelationshipProperty(GraphDatabaseService neo,long relationshiId,String key){
  return neo.getRelationshipById(relationshiId).hasProperty(key);
}

Fixed version (ground truth):
boolean hasRelationshipProperty(GraphDatabaseService graphDb,long relationshiId,String key){
  return graphDb.getRelationshipById(relationshiId).hasProperty(key);
}
Program: 155053
Project: 155053
Buggy source:
Object removeRelationshipProperty(GraphDatabaseService neo,long relationshipId,String key){
  return neo.getRelationshipById(relationshipId).removeProperty(key);
}

Fixed version (ground truth):
Object removeRelationshipProperty(GraphDatabaseService graphDb,long relationshipId,String key){
  return graphDb.getRelationshipById(relationshipId).removeProperty(key);
}