nus-yam/ex-repair huggingface dataset:
Program: 154506
Project: 154506
Buggy source:
private static void configureLogging(){
  String log4jConfigPath=System.getProperty(KEY_LOG4J_CONFIG_XML_PATH);
  if (log4jConfigPath != null) {
    DOMConfigurator.configure(log4jConfigPath);
    System.out.println("String_Node_Str" + log4jConfigPath);
  }
 else {
    BasicConfigurator.configure();
    System.out.println("String_Node_Str");
  }
}

Fixed version (ground truth):
private static void configureLogging(){
  SysOutOverSLF4J.sendSystemOutAndErrToSLF4J();
}
Program: 154508
Project: 154508
Buggy source:
public static Map<Object,Object> getDefaultParams(){
  Map<Object,Object> params=new HashMap<Object,Object>();
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  if (osIsWindows()) {
    params.put(Config.USE_MEMORY_MAPPED_BUFFERS,"String_Node_Str");
  }
  return params;
}

Fixed version (ground truth):
public static Map<Object,Object> getDefaultParams(){
  Map<Object,Object> params=new HashMap<Object,Object>();
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  if (osIsWindows()) {
    params.put(Config.USE_MEMORY_MAPPED_BUFFERS,"String_Node_Str");
  }
 else {
    params.put(Config.USE_MEMORY_MAPPED_BUFFERS,"String_Node_Str");
  }
  return params;
}
Program: 154509
Project: 154509
Buggy source:
public synchronized Node next(){
  if (!hasNext()) {
    throw new NoSuchElementException();
  }
  Node nextNode=currentNode;
  currentNode=null;
  return nextNode;
}

Fixed version (ground truth):
@Override public synchronized Node next(){
  if (!hasNext()) {
    throw new NoSuchElementException();
  }
  Node nextNode=currentNode;
  currentNode=null;
  return nextNode;
}
Program: 154510
Project: 154510
Buggy source:
public void remove(){
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
@Override public void remove(){
  throw new UnsupportedOperationException();
}
Program: 154511
Project: 154511
Buggy source:
public Iterable<Node> getAllNodes(){
  return new Iterable<Node>(){
    public Iterator<Node> iterator(){
      long highId=nodeManager.getHighestPossibleIdInUse(Node.class);
      return new AllNodesIterator(highId);
    }
  }
;
}

Fixed version (ground truth):
public Iterable<Node> getAllNodes(){
  return new Iterable<Node>(){
    @Override public Iterator<Node> iterator(){
      long highId=nodeManager.getHighestPossibleIdInUse(Node.class);
      return new AllNodesIterator(highId);
    }
  }
;
}
Program: 154512
Project: 154512
Buggy source:
public Iterator<Node> iterator(){
  long highId=nodeManager.getHighestPossibleIdInUse(Node.class);
  return new AllNodesIterator(highId);
}

Fixed version (ground truth):
@Override public Iterator<Node> iterator(){
  long highId=nodeManager.getHighestPossibleIdInUse(Node.class);
  return new AllNodesIterator(highId);
}
Program: 154513
Project: 154513
Buggy source:
public void load(){
  extensions.loadExtensions(loaded,msgLog);
}

Fixed version (ground truth):
@Override public void load(){
  extensions.loadExtensions(loaded,msgLog);
}
Program: 154514
Project: 154514
Buggy source:
public TransactionEventsSyncHook create(){
  return transactionEventHandlers.isEmpty() ? null : new TransactionEventsSyncHook(nodeManager,transactionEventHandlers,getConfig().getTxModule().getTxManager());
}

Fixed version (ground truth):
@Override public TransactionEventsSyncHook create(){
  return transactionEventHandlers.isEmpty() ? null : new TransactionEventsSyncHook(nodeManager,transactionEventHandlers,getConfig().getTxModule().getTxManager());
}
Program: 154516
Project: 154516
Buggy source:
public void initializeIndexProviders(){
  extensions.loadIndexImplementations(indexManager,msgLog);
}

Fixed version (ground truth):
@Override public void initializeIndexProviders(){
  extensions.loadIndexImplementations(indexManager,msgLog);
}
Program: 154517
Project: 154517
Buggy source:
public synchronized boolean hasNext(){
  while (currentNode == null && currentNodeId <= highId) {
    try {
      currentNode=getNodeById(currentNodeId++);
    }
 catch (    NotFoundException e) {
    }
  }
  return currentNode != null;
}

Fixed version (ground truth):
@Override public synchronized boolean hasNext(){
  while (currentNode == null && currentNodeId <= highId) {
    try {
      currentNode=getNodeById(currentNodeId++);
    }
 catch (    NotFoundException e) {
    }
  }
  return currentNode != null;
}
Program: 154518
Project: 154518
Buggy source:
public void configureKernelExtensions(){
  loaded=extensions.loadExtensionConfigurations(msgLog);
}

Fixed version (ground truth):
@Override public void configureKernelExtensions(){
  loaded=extensions.loadExtensionConfigurations(msgLog);
}
Program: 154520
Project: 154520
Buggy source:
private void doNewMaster(Pair<Master,Machine> master,StoreId storeId,Exception e){
  try {
    msgLog.logMessage("String_Node_Str" + master + "String_Node_Str",e,true);
    reevaluateMyself(master,storeId);
  }
 catch (  ZooKeeperException ee) {
    msgLog.logMessage("String_Node_Str",ee);
  }
catch (  HaCommunicationException ee) {
    msgLog.logMessage("String_Node_Str",ee);
  }
catch (  Throwable t) {
    t.printStackTrace();
    msgLog.logMessage("String_Node_Str" + t + "String_Node_Str",true);
    shutdown(t instanceof RuntimeException ? (RuntimeException)t : new RuntimeException(t),false);
    if (t instanceof RuntimeException) {
      throw (RuntimeException)t;
    }
    throw new RuntimeException(t);
  }
}

Fixed version (ground truth):
private void doNewMaster(Pair<Master,Machine> master,StoreId storeId,Exception e){
  try {
    msgLog.logMessage("String_Node_Str" + master + "String_Node_Str",e,true);
    reevaluateMyself(master,storeId);
  }
 catch (  ZooKeeperException ee) {
    msgLog.logMessage("String_Node_Str",ee);
  }
catch (  ComException ee) {
    msgLog.logMessage("String_Node_Str",ee);
  }
catch (  Throwable t) {
    t.printStackTrace();
    msgLog.logMessage("String_Node_Str" + t + "String_Node_Str",true);
    shutdown(t instanceof RuntimeException ? (RuntimeException)t : new RuntimeException(t),false);
    if (t instanceof RuntimeException) {
      throw (RuntimeException)t;
    }
    throw new RuntimeException(t);
  }
}
Program: 154521
Project: 154521
Buggy source:
public void pullUpdates(){
  try {
    if (masterServer == null) {
      receive(broker.getMaster().first().pullUpdates(getSlaveContext(-1)));
    }
  }
 catch (  ZooKeeperException e) {
    newMaster(null,e);
    throw e;
  }
catch (  HaCommunicationException e) {
    newMaster(null,e);
    throw e;
  }
}

Fixed version (ground truth):
public void pullUpdates(){
  try {
    if (masterServer == null) {
      receive(broker.getMaster().first().pullUpdates(getSlaveContext(-1)));
    }
  }
 catch (  ZooKeeperException e) {
    newMaster(null,e);
    throw e;
  }
catch (  ComException e) {
    newMaster(null,e);
    throw e;
  }
}
Program: 154522
Project: 154522
Buggy source:
@Override public void getWriteLock(Object resource) throws DeadlockDetectedException, IllegalResourceException {
  try {
    Node node=resource instanceof Node ? (Node)resource : null;
    Relationship relationship=resource instanceof Relationship ? (Relationship)resource : null;
    if (node == null && relationship == null) {
      super.getWriteLock(resource);
      return;
    }
    LockResult result=null;
    do {
      int eventIdentifier=getLocalTxId();
      result=node != null ? receiver.receive(broker.getMaster().first().acquireNodeWriteLock(receiver.getSlaveContext(eventIdentifier),node.getId())) : receiver.receive(broker.getMaster().first().acquireRelationshipWriteLock(receiver.getSlaveContext(eventIdentifier),relationship.getId()));
switch (result.getStatus()) {
case OK_LOCKED:
        super.getWriteLock(resource);
      return;
case DEAD_LOCKED:
    throw new DeadlockDetectedException(result.getDeadlockMessage());
}
}
 while (result.getStatus() == LockStatus.NOT_LOCKED);
}
 catch (ZooKeeperException e) {
receiver.newMaster(null,e);
throw e;
}
catch (HaCommunicationException e) {
receiver.newMaster(null,e);
throw e;
}
}

Fixed version (ground truth):
@Override public void getWriteLock(Object resource) throws DeadlockDetectedException, IllegalResourceException {
  try {
    Node node=resource instanceof Node ? (Node)resource : null;
    Relationship relationship=resource instanceof Relationship ? (Relationship)resource : null;
    if (node == null && relationship == null) {
      super.getWriteLock(resource);
      return;
    }
    LockResult result=null;
    do {
      int eventIdentifier=getLocalTxId();
      result=node != null ? receiver.receive(broker.getMaster().first().acquireNodeWriteLock(receiver.getSlaveContext(eventIdentifier),node.getId())) : receiver.receive(broker.getMaster().first().acquireRelationshipWriteLock(receiver.getSlaveContext(eventIdentifier),relationship.getId()));
switch (result.getStatus()) {
case OK_LOCKED:
        super.getWriteLock(resource);
      return;
case DEAD_LOCKED:
    throw new DeadlockDetectedException(result.getDeadlockMessage());
}
}
 while (result.getStatus() == LockStatus.NOT_LOCKED);
}
 catch (ZooKeeperException e) {
receiver.newMaster(null,e);
throw e;
}
catch (ComException e) {
receiver.newMaster(null,e);
throw e;
}
}
Program: 154523
Project: 154523
Buggy source:
@Override public void getReadLock(Object resource) throws DeadlockDetectedException, IllegalResourceException {
  try {
    Node node=resource instanceof Node ? (Node)resource : null;
    Relationship relationship=resource instanceof Relationship ? (Relationship)resource : null;
    if (node == null && relationship == null) {
      super.getReadLock(resource);
      return;
    }
    LockResult result=null;
    do {
      int eventIdentifier=getLocalTxId();
      result=node != null ? receiver.receive(broker.getMaster().first().acquireNodeReadLock(receiver.getSlaveContext(eventIdentifier),node.getId())) : receiver.receive(broker.getMaster().first().acquireRelationshipReadLock(receiver.getSlaveContext(eventIdentifier),relationship.getId()));
switch (result.getStatus()) {
case OK_LOCKED:
        super.getReadLock(resource);
      return;
case DEAD_LOCKED:
    throw new DeadlockDetectedException(result.getDeadlockMessage());
}
}
 while (result.getStatus() == LockStatus.NOT_LOCKED);
}
 catch (ZooKeeperException e) {
receiver.newMaster(null,e);
throw e;
}
catch (HaCommunicationException e) {
receiver.newMaster(null,e);
throw e;
}
}

Fixed version (ground truth):
@Override public void getReadLock(Object resource) throws DeadlockDetectedException, IllegalResourceException {
  try {
    Node node=resource instanceof Node ? (Node)resource : null;
    Relationship relationship=resource instanceof Relationship ? (Relationship)resource : null;
    if (node == null && relationship == null) {
      super.getReadLock(resource);
      return;
    }
    LockResult result=null;
    do {
      int eventIdentifier=getLocalTxId();
      result=node != null ? receiver.receive(broker.getMaster().first().acquireNodeReadLock(receiver.getSlaveContext(eventIdentifier),node.getId())) : receiver.receive(broker.getMaster().first().acquireRelationshipReadLock(receiver.getSlaveContext(eventIdentifier),relationship.getId()));
switch (result.getStatus()) {
case OK_LOCKED:
        super.getReadLock(resource);
      return;
case DEAD_LOCKED:
    throw new DeadlockDetectedException(result.getDeadlockMessage());
}
}
 while (result.getStatus() == LockStatus.NOT_LOCKED);
}
 catch (ZooKeeperException e) {
receiver.newMaster(null,e);
throw e;
}
catch (ComException e) {
receiver.newMaster(null,e);
throw e;
}
}
Program: 154524
Project: 154524
Buggy source:
public int getOrCreate(TransactionManager txManager,EntityIdGenerator idGenerator,PersistenceManager persistence,RelationshipTypeHolder relTypeHolder,String name){
  try {
    int eventIdentifier=((TxManager)txManager).getEventIdentifier();
    return receiver.receive(broker.getMaster().first().createRelationshipType(receiver.getSlaveContext(eventIdentifier),name));
  }
 catch (  ZooKeeperException e) {
    receiver.newMaster(null,e);
    throw e;
  }
catch (  HaCommunicationException e) {
    receiver.newMaster(null,e);
    throw e;
  }
}

Fixed version (ground truth):
public int getOrCreate(TransactionManager txManager,EntityIdGenerator idGenerator,PersistenceManager persistence,RelationshipTypeHolder relTypeHolder,String name){
  try {
    int eventIdentifier=((TxManager)txManager).getEventIdentifier();
    return receiver.receive(broker.getMaster().first().createRelationshipType(receiver.getSlaveContext(eventIdentifier),name));
  }
 catch (  ZooKeeperException e) {
    receiver.newMaster(null,e);
    throw e;
  }
catch (  ComException e) {
    receiver.newMaster(null,e);
    throw e;
  }
}
Program: 154525
Project: 154525
Buggy source:
public long generate(final XaDataSource dataSource,final int identifier){
  try {
    final int eventIdentifier=txManager.getEventIdentifier();
    Response<Long> response=broker.getMaster().first().commitSingleResourceTransaction(receiver.getSlaveContext(eventIdentifier),dataSource.getName(),new TxExtractor(){
      public void extract(      LogBuffer buffer){
        try {
          dataSource.getPreparedTransaction(identifier,buffer);
        }
 catch (        IOException e) {
          throw new RuntimeException(e);
        }
      }
      public ReadableByteChannel extract(){
        try {
          return dataSource.getPreparedTransaction(identifier);
        }
 catch (        IOException e) {
          throw new RuntimeException(e);
        }
      }
    }
);
    return receiver.receive(response);
  }
 catch (  ZooKeeperException e) {
    receiver.newMaster(null,e);
    throw e;
  }
catch (  HaCommunicationException e) {
    receiver.newMaster(null,e);
    throw e;
  }
}

Fixed version (ground truth):
public long generate(final XaDataSource dataSource,final int identifier){
  try {
    final int eventIdentifier=txManager.getEventIdentifier();
    Response<Long> response=broker.getMaster().first().commitSingleResourceTransaction(receiver.getSlaveContext(eventIdentifier),dataSource.getName(),new TxExtractor(){
      public void extract(      LogBuffer buffer){
        try {
          dataSource.getPreparedTransaction(identifier,buffer);
        }
 catch (        IOException e) {
          throw new RuntimeException(e);
        }
      }
      public ReadableByteChannel extract(){
        try {
          return dataSource.getPreparedTransaction(identifier);
        }
 catch (        IOException e) {
          throw new RuntimeException(e);
        }
      }
    }
);
    return receiver.receive(response);
  }
 catch (  ZooKeeperException e) {
    receiver.newMaster(null,e);
    throw e;
  }
catch (  ComException e) {
    receiver.newMaster(null,e);
    throw e;
  }
}
Program: 154526
Project: 154526
Buggy source:
public void finishTransaction(int eventIdentifier){
  try {
    receiver.receive(broker.getMaster().first().finishTransaction(receiver.getSlaveContext(eventIdentifier)));
  }
 catch (  ZooKeeperException e) {
    receiver.newMaster(null,e);
    throw e;
  }
catch (  HaCommunicationException e) {
    receiver.newMaster(null,e);
    throw e;
  }
}

Fixed version (ground truth):
public void finishTransaction(int eventIdentifier){
  try {
    receiver.receive(broker.getMaster().first().finishTransaction(receiver.getSlaveContext(eventIdentifier)));
  }
 catch (  ZooKeeperException e) {
    receiver.newMaster(null,e);
    throw e;
  }
catch (  ComException e) {
    receiver.newMaster(null,e);
    throw e;
  }
}
Program: 154527
Project: 154527
Buggy source:
public void write(String path,ReadableByteChannel data,ByteBuffer temporaryBuffer,boolean hasData) throws IOException {
  try {
    File file=new File(basePath,path);
    RandomAccessFile randomAccessFile=null;
    try {
      file.getParentFile().mkdirs();
      randomAccessFile=new RandomAccessFile(file,"String_Node_Str");
      if (hasData) {
        FileChannel channel=randomAccessFile.getChannel();
        while (data.read(temporaryBuffer) >= 0) {
          temporaryBuffer.flip();
          channel.write(temporaryBuffer);
          temporaryBuffer.clear();
        }
      }
    }
  finally {
      if (randomAccessFile != null) {
        randomAccessFile.close();
      }
    }
  }
 catch (  Throwable t) {
    t.printStackTrace();
    throw new IOException(t);
  }
}

Fixed version (ground truth):
public void write(String path,ReadableByteChannel data,ByteBuffer temporaryBuffer,boolean hasData) throws IOException {
  try {
    temporaryBuffer.clear();
    File file=new File(basePath,path);
    RandomAccessFile randomAccessFile=null;
    try {
      file.getParentFile().mkdirs();
      randomAccessFile=new RandomAccessFile(file,"String_Node_Str");
      if (hasData) {
        FileChannel channel=randomAccessFile.getChannel();
        while (data.read(temporaryBuffer) >= 0) {
          temporaryBuffer.flip();
          channel.write(temporaryBuffer);
          temporaryBuffer.clear();
        }
      }
    }
  finally {
      if (randomAccessFile != null) {
        randomAccessFile.close();
      }
    }
  }
 catch (  Throwable t) {
    t.printStackTrace();
    throw new IOException(t);
  }
}
Program: 154528
Project: 154528
Buggy source:
private void tryToEnsureIAmNotABrokenMachine(Pair<Master,Machine> master){
  if (master.other().getMachineId() == machineId) {
    return;
  }
 else   if (master.first() == null) {
    RuntimeException cause=new RuntimeException("String_Node_Str");
    shutdown(cause,false);
    throw cause;
  }
  XaDataSource nioneoDataSource=getConfig().getTxModule().getXaDataSourceManager().getXaDataSource(Config.DEFAULT_DATA_SOURCE_NAME);
  long myLastCommittedTx=nioneoDataSource.getLastCommittedTxId();
  long highestCommonTxId=Math.min(myLastCommittedTx,master.other().getLastCommittedTxId());
  int masterForMyHighestCommonTxId=-1;
  try {
    masterForMyHighestCommonTxId=nioneoDataSource.getMasterForCommittedTx(highestCommonTxId);
    ;
  }
 catch (  IOException e) {
    msgLog.logMessage("String_Node_Str" + highestCommonTxId + "String_Node_Str",e);
    return;
  }
  int masterForMastersHighestCommonTxId=master.first().getMasterIdForCommittedTx(highestCommonTxId).response();
  if (masterForMyHighestCommonTxId == masterForMastersHighestCommonTxId) {
    msgLog.logMessage("String_Node_Str" + highestCommonTxId + "String_Node_Str"+ masterForMyHighestCommonTxId,true);
    return;
  }
 else {
    String msg="String_Node_Str" + myLastCommittedTx + "String_Node_Str"+ masterForMyHighestCommonTxId+ "String_Node_Str"+ masterForMastersHighestCommonTxId;
    msgLog.logMessage(msg,true);
    RuntimeException exception=new BranchedDataException(msg);
    shutdown(exception,false);
    throw exception;
  }
}

Fixed version (ground truth):
private void tryToEnsureIAmNotABrokenMachine(Pair<Master,Machine> master){
  if (master.other().getMachineId() == machineId) {
    return;
  }
 else   if (master.first() == null) {
    RuntimeException cause=new RuntimeException("String_Node_Str");
    shutdown(cause,false);
    throw cause;
  }
  XaDataSource nioneoDataSource=getConfig().getTxModule().getXaDataSourceManager().getXaDataSource(Config.DEFAULT_DATA_SOURCE_NAME);
  long myLastCommittedTx=nioneoDataSource.getLastCommittedTxId();
  long highestCommonTxId=Math.min(myLastCommittedTx,master.other().getLastCommittedTxId());
  int masterForMyHighestCommonTxId=-1;
  try {
    masterForMyHighestCommonTxId=nioneoDataSource.getMasterForCommittedTx(highestCommonTxId);
    ;
  }
 catch (  IOException e) {
    msgLog.logMessage("String_Node_Str" + highestCommonTxId + "String_Node_Str",e);
    return;
  }
  int masterForMastersHighestCommonTxId=master.first().getMasterIdForCommittedTx(highestCommonTxId).response();
  if (masterForMyHighestCommonTxId == masterForMastersHighestCommonTxId) {
    msgLog.logMessage("String_Node_Str" + highestCommonTxId + "String_Node_Str"+ masterForMyHighestCommonTxId,true);
    return;
  }
 else {
    String msg="String_Node_Str" + machineId + "String_Node_Str"+ highestCommonTxId+ "String_Node_Str"+ masterForMyHighestCommonTxId+ "String_Node_Str"+ master.other().getMachineId()+ "String_Node_Str"+ masterForMastersHighestCommonTxId;
    msgLog.logMessage(msg,true);
    RuntimeException exception=new BranchedDataException(msg);
    shutdown(exception,false);
    throw exception;
  }
}
Program: 154529
Project: 154529
Buggy source:
protected synchronized void reevaluateMyself(Pair<Master,Machine> master,StoreId storeId){
  if (master == null) {
    master=broker.getMasterReally();
  }
  boolean restarted=false;
  boolean iAmCurrentlyMaster=masterServer != null;
  msgLog.logMessage("String_Node_Str" + machineId + "String_Node_Str"+ master+ "String_Node_Str"+ iAmCurrentlyMaster+ "String_Node_Str");
  if (master.other().getMachineId() == machineId) {
    if (this.localGraph == null || !iAmCurrentlyMaster) {
      internalShutdown();
      startAsMaster(storeId);
      restarted=true;
    }
    broker.rebindMaster();
  }
 else {
    if (this.localGraph == null || iAmCurrentlyMaster) {
      internalShutdown();
      startAsSlave(storeId);
      restarted=true;
    }
 else {
      ((SlaveIdGeneratorFactory)getConfig().getIdGeneratorFactory()).forgetIdAllocationsFromMaster();
    }
    tryToEnsureIAmNotABrokenMachine(broker.getMaster());
  }
  if (restarted) {
    doAfterLocalGraphStarted();
  }
}

Fixed version (ground truth):
protected synchronized void reevaluateMyself(Pair<Master,Machine> master,StoreId storeId){
  if (master == null) {
    master=broker.getMasterReally();
  }
  boolean restarted=false;
  boolean iAmCurrentlyMaster=masterServer != null;
  msgLog.logMessage("String_Node_Str" + machineId + "String_Node_Str"+ master+ "String_Node_Str"+ iAmCurrentlyMaster+ "String_Node_Str");
  if (master.other().getMachineId() == machineId) {
    if (this.localGraph == null || !iAmCurrentlyMaster) {
      internalShutdown();
      startAsMaster(storeId);
      restarted=true;
    }
    broker.rebindMaster();
  }
 else {
    broker.notifyMasterChange(master.other());
    if (this.localGraph == null || iAmCurrentlyMaster) {
      internalShutdown();
      startAsSlave(storeId);
      restarted=true;
    }
 else {
      ((SlaveIdGeneratorFactory)getConfig().getIdGeneratorFactory()).forgetIdAllocationsFromMaster();
    }
    tryToEnsureIAmNotABrokenMachine(broker.getMaster());
  }
  if (restarted) {
    doAfterLocalGraphStarted();
  }
}
Program: 154530
Project: 154530
Buggy source:
protected void setDataChangeWatcher(String child,int currentMasterId){
  try {
    String root=getRoot();
    String path=root + "String_Node_Str" + child;
    byte[] data=null;
    boolean exists=false;
    try {
      data=zooKeeper.getData(path,true,null);
      exists=true;
    }
 catch (    KeeperException e) {
      if (e.code() != KeeperException.Code.NONODE) {
        throw new ZooKeeperException("String_Node_Str",e);
      }
    }
    try {
      data=new byte[4];
      ByteBuffer.wrap(data).putInt(currentMasterId);
      if (!exists) {
        zooKeeper.create(path,data,ZooDefs.Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);
        msgLog.logMessage(child + "String_Node_Str" + currentMasterId);
      }
 else       if (currentMasterId != -1) {
        zooKeeper.setData(path,data,-1);
        msgLog.logMessage(child + "String_Node_Str" + currentMasterId);
      }
      zooKeeper.getData(path,true,null);
    }
 catch (    KeeperException e) {
      if (e.code() != KeeperException.Code.NODEEXISTS) {
        throw new ZooKeeperException("String_Node_Str",e);
      }
    }
  }
 catch (  InterruptedException e) {
    Thread.interrupted();
    throw new ZooKeeperException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
protected void setDataChangeWatcher(String child,int currentMasterId,boolean checkIfCurrentMasterIsSame){
  try {
    String root=getRoot();
    String path=root + "String_Node_Str" + child;
    byte[] data=null;
    boolean exists=false;
    try {
      data=zooKeeper.getData(path,true,null);
      exists=true;
      if (checkIfCurrentMasterIsSame) {
        int id=ByteBuffer.wrap(data).getInt();
        if (currentMasterId == -1 || id == currentMasterId) {
          msgLog.logMessage(child + "String_Node_Str" + currentMasterId);
          return;
        }
      }
    }
 catch (    KeeperException e) {
      if (e.code() != KeeperException.Code.NONODE) {
        throw new ZooKeeperException("String_Node_Str",e);
      }
    }
    try {
      data=new byte[4];
      ByteBuffer.wrap(data).putInt(currentMasterId);
      if (!exists) {
        zooKeeper.create(path,data,ZooDefs.Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);
        msgLog.logMessage(child + "String_Node_Str" + currentMasterId);
      }
 else       if (currentMasterId != -1) {
        zooKeeper.setData(path,data,-1);
        msgLog.logMessage(child + "String_Node_Str" + currentMasterId);
      }
      zooKeeper.getData(path,true,null);
    }
 catch (    KeeperException e) {
      if (e.code() != KeeperException.Code.NODEEXISTS) {
        throw new ZooKeeperException("String_Node_Str",e);
      }
    }
  }
 catch (  InterruptedException e) {
    Thread.interrupted();
    throw new ZooKeeperException("String_Node_Str",e);
  }
}
Program: 154531
Project: 154531
Buggy source:
@Test public void makeSureStoreCantBeUpgradedByBatchInserterEvenIfExplicitlyToldTo() throws Exception {
  String path=path(11);
  new EmbeddedGraphDatabase(path).shutdown();
  setOlderNeoStoreVersion(path);
  try {
    new BatchInserterImpl(path,stringMap(ALLOW_STORE_UPGRADE,"String_Node_Str"));
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException e) {
  }
}

Fixed version (ground truth):
@Test public void makeSureStoreCantBeUpgradedByBatchInserterEvenIfExplicitlyToldTo() throws Exception {
  String path=path(14);
  new EmbeddedGraphDatabase(path).shutdown();
  setOlderNeoStoreVersion(path);
  try {
    new BatchInserterImpl(path,stringMap(ALLOW_STORE_UPGRADE,"String_Node_Str"));
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException e) {
  }
}
Program: 154532
Project: 154532
Buggy source:
private static Iterable<LinkedList<Relationship>> getPaths(Hit hit,DirectionData data){
  LevelData levelData=data.visitedNodes.get(hit.connectingNode);
  if (levelData.depth == 0) {
    Collection<LinkedList<Relationship>> result=new ArrayList<LinkedList<Relationship>>();
    result.add(new LinkedList<Relationship>());
    return result;
  }
  Collection<PathData> set=new ArrayList<PathData>();
  GraphDatabaseService graphDb=data.startNode.getGraphDatabase();
  for (  long rel : levelData.relsToHere) {
    set.add(new PathData(hit.connectingNode,new LinkedList<Relationship>(Arrays.asList(graphDb.getRelationshipById(rel)))));
  }
  for (int i=0; i < levelData.depth - 1; i++) {
    Collection<PathData> nextSet=new ArrayList<PathData>();
    for (    PathData entry : set) {
      int counter=0;
      Node otherNode=entry.rels.getFirst().getOtherNode(entry.node);
      LevelData otherLevelData=data.visitedNodes.get(otherNode);
      for (      long rel : otherLevelData.relsToHere) {
        LinkedList<Relationship> rels=counter++ == 0 ? entry.rels : new LinkedList<Relationship>(entry.rels);
        rels.addFirst(graphDb.getRelationshipById(rel));
        nextSet.add(new PathData(otherNode,rels));
      }
    }
    set=nextSet;
  }
  return new IterableWrapper<LinkedList<Relationship>,PathData>(set){
    @Override protected LinkedList<Relationship> underlyingObjectToObject(    PathData object){
      return object.rels;
    }
  }
;
}

Fixed version (ground truth):
private static Iterable<LinkedList<Relationship>> getPaths(Hit hit,DirectionData data){
  LevelData levelData=data.visitedNodes.get(hit.connectingNode);
  if (levelData.depth == 0) {
    Collection<LinkedList<Relationship>> result=new ArrayList<LinkedList<Relationship>>();
    result.add(new LinkedList<Relationship>());
    return result;
  }
  Collection<PathData> set=new ArrayList<PathData>();
  GraphDatabaseService graphDb=data.startNode.getGraphDatabase();
  for (  long rel : levelData.relsToHere) {
    set.add(new PathData(hit.connectingNode,new LinkedList<Relationship>(Arrays.asList(graphDb.getRelationshipById(rel)))));
  }
  for (int i=0; i < levelData.depth - 1; i++) {
    Collection<PathData> nextSet=new ArrayList<PathData>();
    for (    PathData entry : set) {
      Node otherNode=entry.rels.getFirst().getOtherNode(entry.node);
      LevelData otherLevelData=data.visitedNodes.get(otherNode);
      int counter=0;
      for (      long rel : otherLevelData.relsToHere) {
        LinkedList<Relationship> rels=++counter == otherLevelData.relsToHere.length ? entry.rels : new LinkedList<Relationship>(entry.rels);
        rels.addFirst(graphDb.getRelationshipById(rel));
        nextSet.add(new PathData(otherNode,rels));
      }
    }
    set=nextSet;
  }
  return new IterableWrapper<LinkedList<Relationship>,PathData>(set){
    @Override protected LinkedList<Relationship> underlyingObjectToObject(    PathData object){
      return object.rels;
    }
  }
;
}
Program: 154533
Project: 154533
Buggy source:
public int compareTo(ChannelBuffer buffer){
  return buffer.compareTo(buffer);
}

Fixed version (ground truth):
public int compareTo(ChannelBuffer buffer){
  return this.buffer.compareTo(buffer);
}
Program: 154534
Project: 154534
Buggy source:
public int compareTo(ChannelBuffer buffer){
  return buffer.compareTo(buffer);
}

Fixed version (ground truth):
public int compareTo(ChannelBuffer buffer){
  return this.buffer.compareTo(buffer);
}
Program: 154535
Project: 154535
Buggy source:
@Override protected boolean versionFound(String version){
  if (!version.startsWith("String_Node_Str")) {
    return false;
  }
  if (version.equals("String_Node_Str")) {
    try {
      long fileSize=getFileChannel().size();
      long recordCount=fileSize / getRecordSize();
      if (recordCount > 0xFFFF) {
        throw new IllegalStoreVersionException("String_Node_Str" + version + "String_Node_Str"+ recordCount+ "String_Node_Str"+ "String_Node_Str"+ 0xFFFF+ "String_Node_Str");
      }
    }
 catch (    IOException e) {
      throw new IllegalStoreVersionException("String_Node_Str" + "String_Node_Str" + version + "String_Node_Str");
    }
    return true;
  }
  throw new IllegalStoreVersionException("String_Node_Str" + version + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
@Override protected boolean versionFound(String version){
  if (!version.startsWith("String_Node_Str")) {
    return false;
  }
  String nineFiveVersionString="String_Node_Str";
  if (version.equals(nineFiveVersionString)) {
    try {
      long fileSize=getFileChannel().size();
      long recordCount=(fileSize - nineFiveVersionString.getBytes().length) / getRecordSize();
      if (recordCount > 0xFFFF) {
        throw new IllegalStoreVersionException("String_Node_Str" + version + "String_Node_Str"+ recordCount+ "String_Node_Str"+ "String_Node_Str"+ 0xFFFF+ "String_Node_Str");
      }
    }
 catch (    IOException e) {
      throw new IllegalStoreVersionException("String_Node_Str" + "String_Node_Str" + version + "String_Node_Str");
    }
    return true;
  }
  throw new IllegalStoreVersionException("String_Node_Str" + version + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 154536
Project: 154536
Buggy source:
@Test public void makeSureStoreWithTooManyRelationshipTypesCannotBeUpgraded() throws Exception {
  new EmbeddedGraphDatabase(PATH).shutdown();
  createManyRelationshipTypes(0xFFFF + 10);
  assertCannotStart("String_Node_Str");
}

Fixed version (ground truth):
@Test public void makeSureStoreWithTooManyRelationshipTypesCannotBeUpgraded() throws Exception {
  new EmbeddedGraphDatabase(PATH).shutdown();
  createManyRelationshipTypes(0x10000);
  assertCannotStart("String_Node_Str");
}
Program: 154537
Project: 154537
Buggy source:
@Test public void makeSureStoreWithDecentAmountOfRelationshipTypesCanBeUpgraded() throws Exception {
  new EmbeddedGraphDatabase(PATH).shutdown();
  createManyRelationshipTypes(0xFFFF - 10);
  assertCanStart();
}

Fixed version (ground truth):
@Test public void makeSureStoreWithDecentAmountOfRelationshipTypesCanBeUpgraded() throws Exception {
  new EmbeddedGraphDatabase(PATH).shutdown();
  createManyRelationshipTypes(0xFFFF);
  assertCanStart();
}
Program: 154538
Project: 154538
Buggy source:
DirectionData(Node startNode,Collection<Long> sharedVisitedRels,MutableInteger sharedFrozenDepth,MutableBoolean sharedStop,MutableInteger sharedCurrentDepth,boolean stopAsap,RelationshipExpander expander){
  this.startNode=startNode;
  this.visitedNodes.put(startNode,new LevelData(null,0));
  this.nextNodes.add(startNode);
  this.sharedFrozenDepth=sharedFrozenDepth;
  this.sharedStop=sharedStop;
  this.sharedCurrentDepth=sharedCurrentDepth;
  this.stopAsap=stopAsap;
  this.expander=expander;
  this.sharedVisitedRels=sharedVisitedRels;
  prepareNextLevel();
}

Fixed version (ground truth):
DirectionData(Node startNode,Collection<Long> sharedVisitedRels,MutableInteger sharedFrozenDepth,MutableBoolean sharedStop,MutableInteger sharedCurrentDepth,boolean stopAsap,RelationshipExpander expander){
  this.startNode=startNode;
  this.visitedNodes.put(startNode,new LevelData(null,0));
  this.nextNodes.add(startNode);
  this.sharedFrozenDepth=sharedFrozenDepth;
  this.sharedStop=sharedStop;
  this.sharedCurrentDepth=sharedCurrentDepth;
  this.stopAsap=stopAsap;
  this.expander=expander;
  this.sharedVisitedRels=sharedVisitedRels;
  if (sharedCurrentDepth.value < maxDepth) {
    prepareNextLevel();
  }
 else {
    this.nextRelationships=Collections.<Relationship>emptyList().iterator();
  }
}
Program: 154539
Project: 154539
Buggy source:
private void waitForCommandToComplete(){
  waitFor(DONE,WAITING);
}

Fixed version (ground truth):
public void waitForCommandToComplete(){
  waitFor(DONE,WAITING);
}
Program: 154540
Project: 154540
Buggy source:
private void waitForWorkerToStart(){
  waitFor(STARTING,WAITING);
}

Fixed version (ground truth):
public void waitForWorkerToStart(){
  waitFor(STARTING,WAITING);
}
Program: 154541
Project: 154541
Buggy source:
@Override public void run(){
  CommandState state=new CommandState(index,graphDb);
  threadState.set(STARTING);
  while (state.alive) {
    try {
      latch=new CountDownLatch(1);
      log("String_Node_Str");
      latch.await();
      threadState.set(RUNNING);
      Command command=commands.poll();
      log("String_Node_Str" + command.getClass().getSimpleName());
      command.doWork(state);
      threadState.set(DONE);
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
catch (    Exception exception) {
      this.exception=exception;
      threadState.set(DONE);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  final CommandState state=new CommandState(index,graphDb);
  threadState.set(STARTING);
  while (state.alive) {
    try {
      latch=new CountDownLatch(1);
      log("String_Node_Str");
      latch.await();
      threadState.set(RUNNING);
      Command command=commands.poll();
      log("String_Node_Str" + command.getClass().getSimpleName());
      command.doWork(state);
      threadState.set(DONE);
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
catch (    Exception exception) {
      this.exception=exception;
      threadState.set(DONE);
    }
  }
}
Program: 154542
Project: 154542
Buggy source:
public BaseWorker(Index<Node> index,GraphDatabaseService graphDb){
  this.index=index;
  this.graphDb=graphDb;
  start();
  waitForWorkerToStart();
}

Fixed version (ground truth):
public BaseWorker(Index<Node> index,GraphDatabaseService graphDb){
  this.index=index;
  this.graphDb=graphDb;
  waitForWorkerToStart();
}
Program: 154543
Project: 154543
Buggy source:
@Test public void deleteAndCommitShouldBePublishedToOtherTransaction2() throws InterruptedException {
  WorkThread firstTx=createWorker();
  WorkThread secondTx=createWorker();
  firstTx.beginTransaction();
  secondTx.beginTransaction();
  firstTx.createNodeAndIndexBy(key,"String_Node_Str");
  secondTx.createNodeAndIndexBy(key,"String_Node_Str");
  firstTx.deleteIndex();
  firstTx.commit();
  secondTx.queryIndex(key,"String_Node_Str");
  assertThat(secondTx,hasThrownException());
  secondTx.rollback();
  rollbackTx();
}

Fixed version (ground truth):
@Test public void deleteAndCommitShouldBePublishedToOtherTransaction2() throws InterruptedException {
  WorkThread firstTx=createWorker();
  WorkThread secondTx=createWorker();
  firstTx.beginTransaction();
  firstTx.waitForCommandToComplete();
  secondTx.beginTransaction();
  secondTx.waitForCommandToComplete();
  firstTx.createNodeAndIndexBy(key,"String_Node_Str");
  firstTx.waitForCommandToComplete();
  secondTx.createNodeAndIndexBy(key,"String_Node_Str");
  secondTx.waitForCommandToComplete();
  firstTx.deleteIndex();
  firstTx.waitForCommandToComplete();
  firstTx.commit();
  firstTx.waitForCommandToComplete();
  secondTx.queryIndex(key,"String_Node_Str");
  secondTx.waitForCommandToComplete();
  assertThat(secondTx,hasThrownException());
  secondTx.rollback();
  secondTx.waitForCommandToComplete();
  rollbackTx();
}
Program: 154544
Project: 154544
Buggy source:
private WorkThread createWorker(){
  WorkThread workThread=new WorkThread(index,graphDb);
  workers.add(workThread);
  return workThread;
}

Fixed version (ground truth):
private WorkThread createWorker(){
  WorkThread workThread=new WorkThread(index,graphDb);
  workers.add(workThread);
  workThread.start();
  workThread.waitForWorkerToStart();
  return workThread;
}
Program: 154545
Project: 154545
Buggy source:
@Test public void indexDeletesShouldNotByVisibleUntilCommit(){
  commitTx();
  WorkThread firstTx=createWorker();
  WorkThread secondTx=createWorker();
  firstTx.beginTransaction();
  firstTx.removeFromIndex(key,value);
  assertThat(secondTx.queryIndex(key,value),contains(node));
  firstTx.rollback();
}

Fixed version (ground truth):
@Test public void indexDeletesShouldNotByVisibleUntilCommit(){
  commitTx();
  WorkThread firstTx=createWorker();
  WorkThread secondTx=createWorker();
  firstTx.beginTransaction();
  firstTx.waitForCommandToComplete();
  firstTx.removeFromIndex(key,value);
  firstTx.waitForCommandToComplete();
  IndexHits<Node> indexHits=secondTx.queryIndex(key,value);
  secondTx.waitForCommandToComplete();
  assertThat(indexHits,contains(node));
  firstTx.rollback();
}
Program: 154546
Project: 154546
Buggy source:
@Test public void testHardCoreRecovery() throws Exception {
  String path="String_Node_Str";
  Neo4jTestCase.deleteFileOrDirectory(new File(path));
  Process process=Runtime.getRuntime().exec(new String[]{"String_Node_Str","String_Node_Str",System.getProperty("String_Node_Str"),Inserter.class.getName(),path});
  Thread.sleep(4000);
  process.destroy();
  process.waitFor();
  GraphDatabaseService db=new EmbeddedGraphDatabase(path);
  assertTrue(db.index().existsForNodes("String_Node_Str"));
  Index<Node> index=db.index().forNodes("String_Node_Str");
  for (  Node node : db.getAllNodes()) {
    for (    String key : node.getPropertyKeys()) {
      String value=(String)node.getProperty(key);
      boolean found=false;
      for (      Node indexedNode : index.get(key,value)) {
        if (indexedNode.equals(node)) {
          found=true;
          break;
        }
      }
      if (!found) {
        throw new IllegalStateException(node + "String_Node_Str" + key+ "String_Node_Str"+ value+ "String_Node_Str");
      }
    }
  }
  db.shutdown();
}

Fixed version (ground truth):
@Test public void testHardCoreRecovery() throws Exception {
  String path="String_Node_Str";
  Neo4jTestCase.deleteFileOrDirectory(new File(path));
  Process process=Runtime.getRuntime().exec(new String[]{"String_Node_Str","String_Node_Str",System.getProperty("String_Node_Str"),Inserter.class.getName(),path});
  Thread.sleep(6000);
  process.destroy();
  process.waitFor();
  GraphDatabaseService db=new EmbeddedGraphDatabase(path);
  assertTrue(db.index().existsForNodes("String_Node_Str"));
  Index<Node> index=db.index().forNodes("String_Node_Str");
  for (  Node node : db.getAllNodes()) {
    for (    String key : node.getPropertyKeys()) {
      String value=(String)node.getProperty(key);
      boolean found=false;
      for (      Node indexedNode : index.get(key,value)) {
        if (indexedNode.equals(node)) {
          found=true;
          break;
        }
      }
      if (!found) {
        throw new IllegalStateException(node + "String_Node_Str" + key+ "String_Node_Str"+ value+ "String_Node_Str");
      }
    }
  }
  db.shutdown();
}
Program: 154547
Project: 154547
Buggy source:
private PropertyRecord getRecord(long id,PersistenceWindow window){
  Buffer buffer=window.getOffsettedBuffer(id);
  byte inUseByte=buffer.get();
  boolean inUse=(inUseByte & 0x1) == Record.IN_USE.intValue();
  if (!inUse) {
    throw new InvalidRecordException("String_Node_Str" + id + "String_Node_Str");
  }
  PropertyRecord record=new PropertyRecord(id);
  int typeInt=buffer.getInt();
  record.setType(getEnumType(typeInt & 0xFFFF));
  record.setInUse(true);
  record.setKeyIndexId(buffer.getInt());
  record.setPropBlock(buffer.getLong());
  long prevProp=buffer.getUnsignedInt();
  long prevModifier=prevProp == IdGeneratorImpl.INTEGER_MINUS_ONE && (inUseByte & 0xF0) == 0 ? 0 : (inUseByte & 0xF0) << 28;
  long nextProp=buffer.getUnsignedInt();
  long nextModifier=nextProp == IdGeneratorImpl.INTEGER_MINUS_ONE && (typeInt & 0xF0000) == 0 ? 0 : (typeInt & 0xF0000) << 16;
  record.setPrevProp(longFromIntAndMod(prevProp,prevModifier));
  record.setNextProp(longFromIntAndMod(nextProp,nextModifier));
  return record;
}

Fixed version (ground truth):
private PropertyRecord getRecord(long id,PersistenceWindow window){
  Buffer buffer=window.getOffsettedBuffer(id);
  byte inUseByte=buffer.get();
  boolean inUse=(inUseByte & 0x1) == Record.IN_USE.intValue();
  if (!inUse) {
    throw new InvalidRecordException("String_Node_Str" + id + "String_Node_Str");
  }
  PropertyRecord record=new PropertyRecord(id);
  long typeInt=buffer.getInt();
  record.setType(getEnumType((int)typeInt & 0xFFFF));
  record.setInUse(true);
  record.setKeyIndexId(buffer.getInt());
  record.setPropBlock(buffer.getLong());
  long prevProp=buffer.getUnsignedInt();
  long prevModifier=prevProp == IdGeneratorImpl.INTEGER_MINUS_ONE && (inUseByte & 0xF0) == 0 ? 0 : (inUseByte & 0xF0) << 28;
  long nextProp=buffer.getUnsignedInt();
  long nextModifier=nextProp == IdGeneratorImpl.INTEGER_MINUS_ONE && (typeInt & 0xF0000) == 0 ? 0 : (typeInt & 0xF0000) << 16;
  record.setPrevProp(longFromIntAndMod(prevProp,prevModifier));
  record.setNextProp(longFromIntAndMod(nextProp,nextModifier));
  return record;
}
Program: 154548
Project: 154548
Buggy source:
private void updateRecord(PropertyRecord record,PersistenceWindow window){
  long id=record.getId();
  Buffer buffer=window.getOffsettedBuffer(id);
  if (record.inUse()) {
    long prevProp=record.getPrevProp();
    short prevModifier=prevProp == Record.NO_NEXT_PROPERTY.intValue() ? 0 : (short)((prevProp & 0xF00000000L) >> 28);
    long nextProp=record.getNextProp();
    short nextModifier=nextProp == Record.NO_NEXT_PROPERTY.intValue() ? 0 : (short)((nextProp & 0xF00000000L) >> 16);
    short inUseUnsignedByte=(short)((Record.IN_USE.byteValue() | prevModifier));
    int typeInt=record.getType().intValue();
    typeInt|=nextModifier;
    buffer.put((byte)inUseUnsignedByte).putInt(typeInt).putInt(record.getKeyIndexId()).putLong(record.getPropBlock()).putInt((int)prevProp).putInt((int)nextProp);
  }
 else {
    buffer.put(Record.NOT_IN_USE.byteValue());
    if (!isInRecoveryMode()) {
      freeId(id);
    }
  }
}

Fixed version (ground truth):
private void updateRecord(PropertyRecord record,PersistenceWindow window){
  long id=record.getId();
  Buffer buffer=window.getOffsettedBuffer(id);
  if (record.inUse()) {
    long prevProp=record.getPrevProp();
    long prevModifier=prevProp == Record.NO_NEXT_PROPERTY.intValue() ? 0 : (prevProp & 0xF00000000L) >> 28;
    long nextProp=record.getNextProp();
    long nextModifier=nextProp == Record.NO_NEXT_PROPERTY.intValue() ? 0 : (nextProp & 0xF00000000L) >> 16;
    short inUseUnsignedByte=(short)((Record.IN_USE.byteValue() | prevModifier));
    int typeInt=record.getType().intValue();
    typeInt|=nextModifier;
    buffer.put((byte)inUseUnsignedByte).putInt(typeInt).putInt(record.getKeyIndexId()).putLong(record.getPropBlock()).putInt((int)prevProp).putInt((int)nextProp);
  }
 else {
    buffer.put(Record.NOT_IN_USE.byteValue());
    if (!isInRecoveryMode()) {
      freeId(id);
    }
  }
}
Program: 154549
Project: 154549
Buggy source:
IdBlock copy(){
  IdBlock copy=new IdBlock(highBits);
  copy.ids=new int[length];
  System.arraycopy(ids,0,copy.ids,0,length);
  copy.length=length;
  return copy;
}

Fixed version (ground truth):
IdBlock copy(){
  IdBlock copy=new IdBlock(highBits);
  copy.ids=new int[ids.length];
  System.arraycopy(ids,0,copy.ids,0,length);
  copy.length=length;
  return copy;
}
Program: 154550
Project: 154550
Buggy source:
@SuppressWarnings("String_Node_Str") GraphDatabaseShellServer load(GraphDatabaseService graphDb) throws RemoteException {
  return enable(new GraphDatabaseShellServer(graphDb,(Boolean)getConfig(StartClient.ARG_READONLY,Boolean.FALSE)));
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") GraphDatabaseShellServer load(GraphDatabaseService graphDb) throws RemoteException {
  if (!enable)   return null;
  return enable(new GraphDatabaseShellServer(graphDb,(Boolean)getConfig(StartClient.ARG_READONLY,Boolean.FALSE)));
}
Program: 154551
Project: 154551
Buggy source:
@Test public void canConnectAsAgent() throws Exception {
  Integer port=1234;
  String name="String_Node_Str";
  GraphDatabaseService graphDb=new EmbeddedGraphDatabase("String_Node_Str");
  try {
    new ShellServerExtension().loadAgent(new ShellBootstrap(port.toString(),name).serialize());
  }
  finally {
    graphDb.shutdown();
  }
  ShellLobby.newClient(port.intValue(),name);
}

Fixed version (ground truth):
@Test public void canConnectAsAgent() throws Exception {
  Integer port=Integer.valueOf(1234);
  String name="String_Node_Str";
  GraphDatabaseService graphDb=new EmbeddedGraphDatabase("String_Node_Str");
  try {
    new ShellServerExtension().loadAgent(new ShellBootstrap(port.toString(),name).serialize());
  }
  finally {
    graphDb.shutdown();
  }
  ShellLobby.newClient(port.intValue(),name);
}
Program: 154552
Project: 154552
Buggy source:
private Serializable getConfig(String key,Serializable defaultValue){
  Serializable result=config.get(key);
  return result != null ? result : defaultValue;
}

Fixed version (ground truth):
private Serializable getConfig(String key,Serializable defaultValue){
  Serializable result=config != null ? config.get(key) : null;
  return result != null ? result : defaultValue;
}
Program: 154553
Project: 154553
Buggy source:
public GraphDatabaseShellServer enable(GraphDatabaseShellServer server) throws RemoteException {
  int port=(Integer)getConfig(StartClient.ARG_PORT,AbstractServer.DEFAULT_PORT);
  String name=(String)getConfig(StartClient.ARG_NAME,AbstractServer.DEFAULT_NAME);
  server.makeRemotelyAvailable(port,name);
  return server;
}

Fixed version (ground truth):
public GraphDatabaseShellServer enable(GraphDatabaseShellServer server) throws RemoteException {
  Object portConfig=getConfig(StartClient.ARG_PORT,AbstractServer.DEFAULT_PORT);
  int port;
  if (portConfig instanceof Integer) {
    port=(Integer)portConfig;
  }
 else   if (portConfig instanceof String) {
    port=Integer.parseInt((String)portConfig);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + portConfig);
  }
  String name=(String)getConfig(StartClient.ARG_NAME,AbstractServer.DEFAULT_NAME);
  server.makeRemotelyAvailable(port,name);
  return server;
}