nus-yam/ex-repair huggingface dataset:
Program: 154830
Project: 154830
Buggy source:
public AutoConfigurator(String dbPath,boolean useMemoryMapped,boolean dump){
  this.dbPath=dbPath;
  this.useMemoryMapped=useMemoryMapped;
  OperatingSystemMXBean osBean=ManagementFactory.getOperatingSystemMXBean();
  long mem=-1;
  try {
    Class<?> beanClass=Class.forName("String_Node_Str");
    Method method=beanClass.getMethod("String_Node_Str");
    mem=(Long)method.invoke(osBean);
  }
 catch (  Exception e) {
  }
  if (mem != -1) {
    totalPhysicalMemMb=(int)(mem / 1024 / 1024);
  }
 else {
    totalPhysicalMemMb=-1;
  }
  mem=Runtime.getRuntime().maxMemory();
  maxVmUsageMb=(int)(mem / 1024 / 1024);
  if (dump) {
    System.out.println("String_Node_Str" + totalPhysicalMemMb + "String_Node_Str");
    System.out.println("String_Node_Str" + maxVmUsageMb + "String_Node_Str");
  }
}

Fixed version (ground truth):
public AutoConfigurator(String dbPath,boolean useMemoryMapped,boolean dump){
  this.dbPath=dbPath;
  this.useMemoryMapped=useMemoryMapped;
  OperatingSystemMXBean osBean=ManagementFactory.getOperatingSystemMXBean();
  long mem=-1;
  try {
    Class<?> beanClass=Class.forName("String_Node_Str");
    Method method=beanClass.getMethod("String_Node_Str");
    mem=(Long)method.invoke(osBean);
  }
 catch (  Exception e) {
  }
catch (  LinkageError e) {
  }
  if (mem != -1) {
    totalPhysicalMemMb=(int)(mem / 1024 / 1024);
  }
 else {
    totalPhysicalMemMb=-1;
  }
  mem=Runtime.getRuntime().maxMemory();
  maxVmUsageMb=(int)(mem / 1024 / 1024);
  if (dump) {
    System.out.println("String_Node_Str" + totalPhysicalMemMb + "String_Node_Str");
    System.out.println("String_Node_Str" + maxVmUsageMb + "String_Node_Str");
  }
}
Program: 154832
Project: 154832
Buggy source:
@Override protected Iterator<T> createNestedIterator(final BufferedReader input){
  return new PrefetchingIterator<T>(){
    @Override protected T fetchNextOrNull(){
      try {
        String line;
        while (null != (line=input.readLine())) {
          try {
            return type.cast(Class.forName(line).newInstance());
          }
 catch (          Exception e) {
            return null;
          }
catch (          LinkageError e) {
            return null;
          }
        }
        return null;
      }
 catch (      IOException e) {
        return null;
      }
    }
  }
;
}

Fixed version (ground truth):
@Override protected Iterator<T> createNestedIterator(final BufferedReader input){
  return new PrefetchingIterator<T>(){
    @Override protected T fetchNextOrNull(){
      try {
        String line;
        while (null != (line=input.readLine())) {
          try {
            return type.cast(Class.forName(line).newInstance());
          }
 catch (          Exception e) {
          }
catch (          LinkageError e) {
          }
        }
        return null;
      }
 catch (      IOException e) {
        return null;
      }
    }
  }
;
}
Program: 154833
Project: 154833
Buggy source:
@Override protected T fetchNextOrNull(){
  try {
    String line;
    while (null != (line=input.readLine())) {
      try {
        return type.cast(Class.forName(line).newInstance());
      }
 catch (      Exception e) {
        return null;
      }
catch (      LinkageError e) {
        return null;
      }
    }
    return null;
  }
 catch (  IOException e) {
    return null;
  }
}

Fixed version (ground truth):
@Override protected T fetchNextOrNull(){
  try {
    String line;
    while (null != (line=input.readLine())) {
      try {
        return type.cast(Class.forName(line).newInstance());
      }
 catch (      Exception e) {
      }
catch (      LinkageError e) {
      }
    }
    return null;
  }
 catch (  IOException e) {
    return null;
  }
}
Program: 154834
Project: 154834
Buggy source:
private static <T>Iterable<T> ourOwnLoader(final Class<T> type){
  List<URL> urls=new LinkedList<URL>();
  try {
    Enumeration<URL> resources=Thread.currentThread().getContextClassLoader().getResources("String_Node_Str" + type.getName());
    while (resources.hasMoreElements()) {
      urls.add(resources.nextElement());
    }
  }
 catch (  IOException e) {
    return null;
  }
  return new NestingIterable<T,BufferedReader>(FilteringIterable.notNull(new IterableWrapper<BufferedReader,URL>(urls){
    @Override protected BufferedReader underlyingObjectToObject(    URL url){
      try {
        return new BufferedReader(new InputStreamReader(url.openStream()));
      }
 catch (      IOException e) {
        return null;
      }
    }
  }
)){
    @Override protected Iterator<T> createNestedIterator(    final BufferedReader input){
      return new PrefetchingIterator<T>(){
        @Override protected T fetchNextOrNull(){
          try {
            String line;
            while (null != (line=input.readLine())) {
              try {
                return type.cast(Class.forName(line).newInstance());
              }
 catch (              Exception e) {
                return null;
              }
catch (              LinkageError e) {
                return null;
              }
            }
            return null;
          }
 catch (          IOException e) {
            return null;
          }
        }
      }
;
    }
  }
;
}

Fixed version (ground truth):
private static <T>Iterable<T> ourOwnLoader(final Class<T> type){
  List<URL> urls=new LinkedList<URL>();
  try {
    Enumeration<URL> resources=Thread.currentThread().getContextClassLoader().getResources("String_Node_Str" + type.getName());
    while (resources.hasMoreElements()) {
      urls.add(resources.nextElement());
    }
  }
 catch (  IOException e) {
    return null;
  }
  return new NestingIterable<T,BufferedReader>(FilteringIterable.notNull(new IterableWrapper<BufferedReader,URL>(urls){
    @Override protected BufferedReader underlyingObjectToObject(    URL url){
      try {
        return new BufferedReader(new InputStreamReader(url.openStream()));
      }
 catch (      IOException e) {
        return null;
      }
    }
  }
)){
    @Override protected Iterator<T> createNestedIterator(    final BufferedReader input){
      return new PrefetchingIterator<T>(){
        @Override protected T fetchNextOrNull(){
          try {
            String line;
            while (null != (line=input.readLine())) {
              try {
                return type.cast(Class.forName(line).newInstance());
              }
 catch (              Exception e) {
              }
catch (              LinkageError e) {
              }
            }
            return null;
          }
 catch (          IOException e) {
            return null;
          }
        }
      }
;
    }
  }
;
}
Program: 154835
Project: 154835
Buggy source:
protected void registerIdFromUpdateRecord(long id){
  highestUpdateRecordId=Math.max(highestUpdateRecordId,id);
}

Fixed version (ground truth):
protected void registerIdFromUpdateRecord(long id){
  highestUpdateRecordId=Math.max(highestUpdateRecordId,id + 1);
}
Program: 154836
Project: 154836
Buggy source:
XaLogicalLog(String fileName,XaResourceManager xaRm,XaCommandFactory cf,XaTransactionFactory xaTf,Map<Object,Object> config){
  this.fileName=fileName;
  this.xaRm=xaRm;
  this.cf=cf;
  this.xaTf=xaTf;
  this.useMemoryMapped=getMemoryMapped(config);
  log=Logger.getLogger(this.getClass().getName() + "String_Node_Str" + fileName);
  buffer=ByteBuffer.allocateDirect(9 + Xid.MAXGTRIDSIZE + Xid.MAXBQUALSIZE * 10);
  String root=(String)config.get("String_Node_Str");
  msgLog=StringLogger.getLogger(root + "String_Node_Str");
}

Fixed version (ground truth):
XaLogicalLog(String fileName,XaResourceManager xaRm,XaCommandFactory cf,XaTransactionFactory xaTf,Map<Object,Object> config){
  this.fileName=fileName;
  this.xaRm=xaRm;
  this.cf=cf;
  this.xaTf=xaTf;
  this.useMemoryMapped=getMemoryMapped(config);
  log=Logger.getLogger(this.getClass().getName() + "String_Node_Str" + fileName);
  buffer=ByteBuffer.allocateDirect(9 + Xid.MAXGTRIDSIZE + Xid.MAXBQUALSIZE * 10);
  storeDir=(String)config.get("String_Node_Str");
  msgLog=StringLogger.getLogger(new File(storeDir,"String_Node_Str").getPath());
}
Program: 154837
Project: 154837
Buggy source:
private String generateUniqueName(String baseName){
  String tmpName=baseName + "String_Node_Str" + System.currentTimeMillis();
  while (new File(tmpName).exists()) {
    tmpName=baseName + "String_Node_Str" + System.currentTimeMillis()+ "String_Node_Str";
  }
  return tmpName;
}

Fixed version (ground truth):
private String generateUniqueName(String baseName){
  File tmpFile=null;
  while (tmpFile == null || tmpFile.exists()) {
    tmpFile=new File(storeDir,baseName + "String_Node_Str" + System.currentTimeMillis());
  }
  return tmpFile.getPath();
}
Program: 154838
Project: 154838
Buggy source:
private void writeOutLogEntryList(List<LogEntry> logEntryList,String name,String tmpNameHint) throws IOException {
  String tmpName=generateUniqueName(tmpNameHint);
  FileChannel txLog=new RandomAccessFile(tmpName,"String_Node_Str").getChannel();
  LogBuffer buf=new DirectMappedLogBuffer(txLog);
  for (  LogEntry entry : logEntryList) {
    LogIoUtils.writeLogEntry(entry,buf);
  }
  buf.force();
  txLog.close();
  if (!new File(tmpName).renameTo(new File(name))) {
    throw new IOException("String_Node_Str" + tmpName + "String_Node_Str"+ name);
  }
}

Fixed version (ground truth):
private void writeOutLogEntryList(List<LogEntry> logEntryList,String name,String tmpNameHint) throws IOException {
  String tmpName=generateUniqueName(tmpNameHint);
  System.out.println("String_Node_Str" + tmpName);
  FileChannel txLog=new RandomAccessFile(tmpName,"String_Node_Str").getChannel();
  LogBuffer buf=new DirectMappedLogBuffer(txLog);
  for (  LogEntry entry : logEntryList) {
    LogIoUtils.writeLogEntry(entry,buf);
  }
  buf.force();
  txLog.close();
  if (!new File(tmpName).renameTo(new File(name))) {
    throw new IOException("String_Node_Str" + tmpName + "String_Node_Str"+ name);
  }
}
Program: 154839
Project: 154839
Buggy source:
<T>T makeProxy(ObjectName name,Class<T> beanType){
  try {
    final Method factoryMethod;
    if (isMXBeanInterface(beanType)) {
      factoryMethod=newMXBeanProxy;
    }
 else {
      factoryMethod=newMBeanProxy;
    }
    return beanType.cast(factoryMethod.invoke(null,getPlatformMBeanServer(),name,beanType));
  }
 catch (  InvocationTargetException exception) {
    throw launderRuntimeException(exception.getTargetException());
  }
catch (  Exception exception) {
    throw new UnsupportedOperationException("String_Node_Str",exception);
  }
}

Fixed version (ground truth):
@Override <T>T makeProxy(ObjectName name,Class<T> beanType){
  return MBeanServerInvocationHandler.newProxyInstance(getPlatformMBeanServer(),name,beanType,false);
}
Program: 154840
Project: 154840
Buggy source:
ProxyMaker() throws Exception {
  Class<?> JMX=Class.forName("String_Node_Str");
  this.isMXBeanInterface=JMX.getMethod("String_Node_Str",Class.class);
  this.newMBeanProxy=JMX.getMethod("String_Node_Str",MBeanServerConnection.class,ObjectName.class,Class.class);
  this.newMXBeanProxy=JMX.getMethod("String_Node_Str",MBeanServerConnection.class,ObjectName.class,Class.class);
}

Fixed version (ground truth):
ProxyMaker(boolean supportsMxBean){
  this.supportsMxBean=supportsMxBean;
}
Program: 154841
Project: 154841
Buggy source:
public GraphDatabaseShellServer(GraphDatabaseService graphDb) throws RemoteException {
  super();
  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):
public GraphDatabaseShellServer(GraphDatabaseService graphDb) throws RemoteException {
  super();
  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");
  this.graphDbCreatedHere=true;
}
Program: 154842
Project: 154842
Buggy source:
public void shutdown(){
  this.graphDb.shutdown();
}

Fixed version (ground truth):
public void shutdown(){
  if (graphDbCreatedHere) {
    this.graphDb.shutdown();
  }
}
Program: 154843
Project: 154843
Buggy source:
public synchronized void applyLog(ReadableByteChannel byteChannel) throws IOException {
  if (!backupSlave) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (xidIdentMap.size() > 0) {
    throw new IllegalStateException("String_Node_Str");
  }
  buffer.clear();
  buffer.limit(8);
  if (byteChannel.read(buffer) != 8) {
    throw new IOException("String_Node_Str");
  }
  buffer.flip();
  logVersion=buffer.getLong();
  if (logVersion != xaTf.getCurrentVersion()) {
    throw new IllegalStateException("String_Node_Str" + logVersion + "String_Node_Str"+ xaTf.getCurrentVersion());
  }
  msgLog.logMessage("String_Node_Str" + logVersion);
  log.fine("String_Node_Str" + logVersion);
  long logEntriesFound=0;
  LogApplier logApplier=new LogApplier(byteChannel,buffer,xaTf,xaRm,cf,xidIdentMap,recoveredTxMap);
  while (logApplier.readAndApplyEntry()) {
    logEntriesFound++;
  }
  byteChannel.close();
  xaTf.flushAll();
  xaTf.getAndSetNewVersion();
  xaRm.reset();
  msgLog.logMessage("String_Node_Str" + logVersion + "String_Node_Str"+ logEntriesFound+ "String_Node_Str");
  log.info("String_Node_Str" + fileName + "String_Node_Str"+ logVersion+ "String_Node_Str");
}

Fixed version (ground truth):
public synchronized void applyLog(ReadableByteChannel byteChannel) throws IOException {
  if (!backupSlave) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (xidIdentMap.size() > 0) {
    throw new IllegalStateException("String_Node_Str");
  }
  buffer.clear();
  buffer.limit(8);
  if (byteChannel.read(buffer) != 8) {
    throw new IOException("String_Node_Str");
  }
  buffer.flip();
  logVersion=buffer.getLong();
  if (logVersion != xaTf.getCurrentVersion()) {
    throw new IllegalStateException("String_Node_Str" + logVersion + "String_Node_Str"+ xaTf.getCurrentVersion());
  }
  msgLog.logMessage("String_Node_Str" + logVersion);
  log.fine("String_Node_Str" + logVersion);
  long logEntriesFound=0;
  LogApplier logApplier=new LogApplier(byteChannel,buffer,xaTf,xaRm,cf,xidIdentMap,recoveredTxMap);
  scanIsComplete=false;
  while (logApplier.readAndApplyEntry()) {
    logEntriesFound++;
  }
  scanIsComplete=true;
  byteChannel.close();
  xaTf.flushAll();
  xaTf.getAndSetNewVersion();
  xaRm.reset();
  msgLog.logMessage("String_Node_Str" + logVersion + "String_Node_Str"+ logEntriesFound+ "String_Node_Str");
  log.info("String_Node_Str" + fileName + "String_Node_Str"+ logVersion+ "String_Node_Str");
}
Program: 154845
Project: 154845
Buggy source:
@Override public void run(){
  reevaluateMyself();
}

Fixed version (ground truth):
@Override public void run(){
  for (int i=0; i < 5; i++) {
    try {
      reevaluateMyself();
      break;
    }
 catch (    ZooKeeperException e) {
      e.printStackTrace();
    }
catch (    HaCommunicationException e) {
      e.printStackTrace();
    }
  }
}
Program: 154846
Project: 154846
Buggy source:
public void somethingIsWrong(Exception e){
  new Thread(){
    @Override public void run(){
      reevaluateMyself();
    }
  }
.start();
}

Fixed version (ground truth):
public void somethingIsWrong(Exception e){
  new Thread(){
    @Override public void run(){
      for (int i=0; i < 5; i++) {
        try {
          reevaluateMyself();
          break;
        }
 catch (        ZooKeeperException e) {
          e.printStackTrace();
        }
catch (        HaCommunicationException e) {
          e.printStackTrace();
        }
      }
    }
  }
.start();
}
Program: 154847
Project: 154847
Buggy source:
public synchronized void shutdown(){
  if (this.broker != null) {
    this.broker.shutdown();
    this.broker=null;
  }
  internalShutdown();
}

Fixed version (ground truth):
public synchronized void shutdown(){
  if (this.broker != null) {
    this.broker.shutdown();
  }
  internalShutdown();
}
Program: 154848
Project: 154848
Buggy source:
public void process(WatchedEvent event){
  String path=event.getPath();
  System.out.println(this + "String_Node_Str" + new Date()+ "String_Node_Str"+ event+ "String_Node_Str"+ path+ "String_Node_Str");
  if (path == null && event.getState() == Watcher.Event.KeeperState.Expired) {
    keeperState=KeeperState.Expired;
    zooKeeper=instantiateZooKeeper();
  }
 else   if (path == null && event.getState() == Watcher.Event.KeeperState.SyncConnected) {
    sequenceNr=setup();
    keeperState=KeeperState.SyncConnected;
    receiver.somethingIsWrong(new Exception());
  }
 else   if (path == null && event.getState() == Watcher.Event.KeeperState.Disconnected) {
    keeperState=KeeperState.Disconnected;
  }
 else   if (event.getType() == Watcher.Event.EventType.NodeDataChanged) {
    System.out.println("String_Node_Str");
    receiver.somethingIsWrong(new Exception());
  }
}

Fixed version (ground truth):
public void process(WatchedEvent event){
  String path=event.getPath();
  System.out.println(this + "String_Node_Str" + new Date()+ "String_Node_Str"+ event+ "String_Node_Str"+ path+ "String_Node_Str");
  if (path == null && event.getState() == Watcher.Event.KeeperState.Expired) {
    keeperState=KeeperState.Expired;
    zooKeeper=instantiateZooKeeper();
  }
 else   if (path == null && event.getState() == Watcher.Event.KeeperState.SyncConnected) {
    sequenceNr=setup();
    keeperState=KeeperState.SyncConnected;
    if (firstSyncConnected) {
      firstSyncConnected=false;
    }
 else {
      receiver.somethingIsWrong(new Exception());
    }
  }
 else   if (path == null && event.getState() == Watcher.Event.KeeperState.Disconnected) {
    keeperState=KeeperState.Disconnected;
  }
 else   if (event.getType() == Watcher.Event.EventType.NodeDataChanged) {
    System.out.println("String_Node_Str");
    receiver.somethingIsWrong(new Exception());
  }
}
Program: 154849
Project: 154849
Buggy source:
private void setMasterChangeWatcher(int currentMasterId){
  try {
    String root=getRoot();
    String path=root + "String_Node_Str" + MASTER_NOTIFY_CHILD;
    byte[] data=null;
    boolean exists=false;
    try {
      data=zooKeeper.getData(path,true,null);
      exists=true;
      if (data[0] == currentMasterId) {
        return;
      }
    }
 catch (    KeeperException e) {
      if (e.code() != KeeperException.Code.NONODE) {
        throw new ZooKeeperException("String_Node_Str",e);
      }
    }
    try {
      data=new byte[]{(byte)currentMasterId};
      if (!exists) {
        zooKeeper.create(path,data,ZooDefs.Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);
      }
      zooKeeper.setData(path,data,-1);
      System.out.println("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):
private void setMasterChangeWatcher(int currentMasterId){
  try {
    String root=getRoot();
    String path=root + "String_Node_Str" + MASTER_NOTIFY_CHILD;
    byte[] data=null;
    boolean exists=false;
    try {
      data=zooKeeper.getData(path,true,null);
      exists=true;
      int id=ByteBuffer.wrap(data).getInt();
      if (id == 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);
      }
 else {
        zooKeeper.setData(path,data,-1);
      }
      System.out.println("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: 154850
Project: 154850
Buggy source:
public String getRoot(){
  byte[] rootData=null;
  do {
    try {
      rootData=zooKeeper.getData(rootPath,false,null);
      return rootPath;
    }
 catch (    KeeperException e) {
      if (e.code() != KeeperException.Code.NONODE) {
        throw new ZooKeeperException("String_Node_Str",e);
      }
    }
catch (    InterruptedException e) {
      Thread.interrupted();
      throw new ZooKeeperException("String_Node_Str",e);
    }
    try {
      byte data[]=new byte[0];
      zooKeeper.create(rootPath,data,ZooDefs.Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);
    }
 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);
    }
  }
 while (rootData == null);
  throw new IllegalStateException();
}

Fixed version (ground truth):
public String getRoot(){
  States state=zooKeeper.getState();
  System.out.println("String_Node_Str" + state + "String_Node_Str"+ state.isAlive());
  byte[] rootData=null;
  do {
    try {
      rootData=zooKeeper.getData(rootPath,false,null);
      return rootPath;
    }
 catch (    KeeperException e) {
      if (e.code() != KeeperException.Code.NONODE) {
        throw new ZooKeeperException("String_Node_Str",e);
      }
    }
catch (    InterruptedException e) {
      Thread.interrupted();
      throw new ZooKeeperException("String_Node_Str",e);
    }
    try {
      byte data[]=new byte[0];
      zooKeeper.create(rootPath,data,ZooDefs.Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);
    }
 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);
    }
  }
 while (rootData == null);
  throw new IllegalStateException();
}
Program: 154851
Project: 154851
Buggy source:
@Override protected StandaloneDbCom spawnJvm(File path,int port,int machineId,String... extraArgs) throws Exception {
  List<String> myExtraArgs=new ArrayList<String>();
  myExtraArgs.add("String_Node_Str" + HighlyAvailableGraphDatabase.CONFIG_KEY_HA_MACHINE_ID);
  myExtraArgs.add("String_Node_Str" + (machineId + 1));
  myExtraArgs.add("String_Node_Str" + HighlyAvailableGraphDatabase.CONFIG_KEY_HA_ZOO_KEEPER_SERVERS);
  myExtraArgs.add(buildZooKeeperServersConfigValue(ZOO_KEEPER_CLUSTER_SIZE));
  myExtraArgs.add("String_Node_Str" + HighlyAvailableGraphDatabase.CONFIG_KEY_HA_SERVER);
  myExtraArgs.add(haServersConfig);
  myExtraArgs.addAll(Arrays.asList(extraArgs));
  StandaloneDbCom com=super.spawnJvm(path,port,machineId,myExtraArgs.toArray(new String[myExtraArgs.size()]));
  com.awaitStarted();
  jvmByMachineId.put(com.getMachineId(),com);
  return com;
}

Fixed version (ground truth):
@Override protected StandaloneDbCom spawnJvm(File path,int port,int machineId,String... extraArgs) throws Exception {
  List<String> myExtraArgs=new ArrayList<String>();
  myExtraArgs.add("String_Node_Str" + HighlyAvailableGraphDatabase.CONFIG_KEY_HA_MACHINE_ID);
  myExtraArgs.add("String_Node_Str" + (machineId + 1));
  myExtraArgs.add("String_Node_Str" + HighlyAvailableGraphDatabase.CONFIG_KEY_HA_ZOO_KEEPER_SERVERS);
  myExtraArgs.add(buildZooKeeperServersConfigValue(ZOO_KEEPER_CLUSTER_SIZE));
  myExtraArgs.add("String_Node_Str" + HighlyAvailableGraphDatabase.CONFIG_KEY_HA_SERVER);
  myExtraArgs.add(buildHaServerConfigValue(machineId));
  myExtraArgs.addAll(Arrays.asList(extraArgs));
  StandaloneDbCom com=super.spawnJvm(path,port,machineId,myExtraArgs.toArray(new String[myExtraArgs.size()]));
  com.awaitStarted();
  jvmByMachineId.put(com.getMachineId(),com);
  return com;
}
Program: 154852
Project: 154852
Buggy source:
@Override protected void initializeDbs(int numSlaves,Map<String,String> config) throws Exception {
  this.jvmByMachineId=new HashMap<Integer,StandaloneDbCom>();
  haServersConfig=buildHaServersConfigValue(numSlaves + 1);
  super.initializeDbs(numSlaves,config);
  zooKeeperMasterFetcher=new ClusterManager(buildZooKeeperServersConfigValue(ZOO_KEEPER_CLUSTER_SIZE));
}

Fixed version (ground truth):
@Override protected void initializeDbs(int numSlaves,Map<String,String> config) throws Exception {
  this.jvmByMachineId=new HashMap<Integer,StandaloneDbCom>();
  super.initializeDbs(numSlaves,config);
  zooKeeperMasterFetcher=new ClusterManager(buildZooKeeperServersConfigValue(ZOO_KEEPER_CLUSTER_SIZE));
}
Program: 154853
Project: 154853
Buggy source:
/** 
 * Returns the disconnected slaves in this cluster so that all slaves which are specified in the HA servers configuration, but not in the zoo keeper cluster will be returned.
 * @return the disconnected slaves in this cluster.
 */
public MachineInfo[] getDisconnectedSlaves(){
  Collection<MachineInfo> infos=new ArrayList<MachineInfo>();
  for (  Map.Entry<Integer,String> entry : haServers.entrySet()) {
    infos.add(new MachineInfo(entry.getKey(),-1,-1,entry.getValue()));
  }
  infos.removeAll(Arrays.asList(getAllMachines()));
  return infos.toArray(new MachineInfo[infos.size()]);
}

Fixed version (ground truth):
/** 
 * Returns the disconnected slaves in this cluster so that all slaves which are specified in the HA servers configuration, but not in the zoo keeper cluster will be returned.
 * @return the disconnected slaves in this cluster.
 */
public MachineInfo[] getDisconnectedSlaves(){
  Collection<MachineInfo> infos=new ArrayList<MachineInfo>();
  for (  Map.Entry<Integer,String> entry : haServers.entrySet()) {
    infos.add(new MachineInfo(entry.getKey(),-1,-1,entry.getValue()));
  }
  infos.removeAll(getAllMachines().values());
  return infos.toArray(new MachineInfo[infos.size()]);
}
Program: 154854
Project: 154854
Buggy source:
@Override protected String exec(AppCommandParser parser,Session session,Output out) throws Exception {
  HighlyAvailableGraphDatabase db=(HighlyAvailableGraphDatabase)getServer().getDb();
  MasterServer master=db.getMasterServerIfMaster();
  out.println("String_Node_Str" + (master != null ? "String_Node_Str" : "String_Node_Str"));
  if (master != null) {
    out.println("String_Node_Str");
    for (    Pair<Integer,Collection<Integer>> entry : master.getConnectedClients()) {
      out.println("String_Node_Str" + entry.first());
      if (!entry.other().isEmpty()) {
        out.println("String_Node_Str" + entry.other());
      }
    }
  }
  return null;
}

Fixed version (ground truth):
@Override protected String exec(AppCommandParser parser,Session session,Output out) throws Exception {
  HighlyAvailableGraphDatabase db=(HighlyAvailableGraphDatabase)getServer().getDb();
  MasterServer master=db.getMasterServerIfMaster();
  out.println("String_Node_Str" + (master != null ? "String_Node_Str" : "String_Node_Str"));
  if (master != null) {
    out.println("String_Node_Str");
    for (    Pair<Integer,Collection<Integer>> entry : master.getConnectedClients()) {
      out.println("String_Node_Str" + entry.first());
      if (entry.other() != null && !entry.other().isEmpty()) {
        out.println("String_Node_Str" + entry.other());
      }
    }
  }
  return null;
}
Program: 154855
Project: 154855
Buggy source:
/** 
 * Returns pairs of: key: machine ID value: collection of ongoing transaction event identifiers
 */
public Iterable<Pair<Integer,Collection<Integer>>> getConnectedClients(){
  Collection<Integer> clients=null;
synchronized (channelsPerClient) {
    clients=new ArrayList<Integer>(channelsPerClient.keySet());
  }
  Map<Integer,Collection<Integer>> txs=((MasterImpl)realMaster).getOngoingTransactions();
  Collection<Pair<Integer,Collection<Integer>>> result=new ArrayList<Pair<Integer,Collection<Integer>>>();
  for (  Integer id : clients) {
    result.add(new Pair<Integer,Collection<Integer>>(id,txs.get(id)));
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Returns pairs of: key: machine ID value: collection of ongoing transaction event identifiers
 */
public Iterable<Pair<Integer,Collection<Integer>>> getConnectedClients(){
  Collection<Integer> clients=null;
synchronized (channelsPerClient) {
    clients=new ArrayList<Integer>(channelsPerClient.keySet());
  }
  Map<Integer,Collection<Integer>> txs=((MasterImpl)realMaster).getOngoingTransactions();
  Collection<Pair<Integer,Collection<Integer>>> result=new ArrayList<Pair<Integer,Collection<Integer>>>();
  for (  Integer id : clients) {
    Collection<Integer> ongoingTxs=txs.get(id);
    result.add(new Pair<Integer,Collection<Integer>>(id,ongoingTxs != null ? ongoingTxs : Collections.<Integer>emptyList()));
  }
  return result;
}
Program: 154856
Project: 154856
Buggy source:
public void process(WatchedEvent event){
  String path=event.getPath();
  System.out.println(this + "String_Node_Str" + new Date()+ "String_Node_Str"+ event+ "String_Node_Str"+ path+ "String_Node_Str");
  if (path == null && event.getState() == Watcher.Event.KeeperState.Expired) {
    keeperState=KeeperState.Expired;
    instantiateZooKeeper();
  }
 else   if (path == null && event.getState() == Watcher.Event.KeeperState.SyncConnected) {
    sequenceNr=setup();
    keeperState=KeeperState.SyncConnected;
    receiver.somethingIsWrong(new Exception());
  }
 else   if (path == null && event.getState() == Watcher.Event.KeeperState.Disconnected) {
    keeperState=KeeperState.Disconnected;
  }
 else   if (event.getType() == Watcher.Event.EventType.NodeDataChanged) {
    System.out.println("String_Node_Str");
    receiver.somethingIsWrong(new Exception());
  }
}

Fixed version (ground truth):
public void process(WatchedEvent event){
  String path=event.getPath();
  System.out.println(this + "String_Node_Str" + new Date()+ "String_Node_Str"+ event+ "String_Node_Str"+ path+ "String_Node_Str");
  if (path == null && event.getState() == Watcher.Event.KeeperState.Expired) {
    keeperState=KeeperState.Expired;
    zooKeeper=instantiateZooKeeper();
  }
 else   if (path == null && event.getState() == Watcher.Event.KeeperState.SyncConnected) {
    sequenceNr=setup();
    keeperState=KeeperState.SyncConnected;
    receiver.somethingIsWrong(new Exception());
  }
 else   if (path == null && event.getState() == Watcher.Event.KeeperState.Disconnected) {
    keeperState=KeeperState.Disconnected;
  }
 else   if (event.getType() == Watcher.Event.EventType.NodeDataChanged) {
    System.out.println("String_Node_Str");
    receiver.somethingIsWrong(new Exception());
  }
}
Program: 154858
Project: 154858
Buggy source:
synchronized XaTransaction commit(Xid xid,boolean onePhase) throws XAException {
  XidStatus status=xidMap.get(xid);
  if (status == null) {
    throw new XAException("String_Node_Str" + xid + "String_Node_Str");
  }
  TransactionStatus txStatus=status.getTransactionStatus();
  XaTransaction xaTransaction=txStatus.getTransaction();
  if (onePhase) {
    if (!xaTransaction.isReadOnly()) {
      if (!xaTransaction.isRecovered()) {
        xaTransaction.prepare();
        log.commitOnePhase(xaTransaction.getIdentifier());
      }
    }
    txStatus.markAsPrepared();
  }
  if (!txStatus.prepared() || txStatus.rollback()) {
    throw new XAException("String_Node_Str" + "String_Node_Str");
  }
  if (!xaTransaction.isReadOnly()) {
    if (!xaTransaction.isRecovered()) {
      if (!onePhase) {
        log.commitTwoPhase(xaTransaction.getIdentifier());
      }
    }
    txStatus.markCommitStarted();
    xaTransaction.commit();
  }
  log.done(xaTransaction.getIdentifier());
  xidMap.remove(xid);
  if (xaTransaction.isRecovered()) {
    recoveredTxCount--;
    checkIfRecoveryComplete();
  }
  return xaTransaction;
}

Fixed version (ground truth):
synchronized XaTransaction commit(Xid xid,boolean onePhase) throws XAException {
  XidStatus status=xidMap.get(xid);
  if (status == null) {
    throw new XAException("String_Node_Str" + xid + "String_Node_Str");
  }
  TransactionStatus txStatus=status.getTransactionStatus();
  XaTransaction xaTransaction=txStatus.getTransaction();
  if (onePhase) {
    if (!xaTransaction.isReadOnly()) {
      if (!xaTransaction.isRecovered()) {
        xaTransaction.prepare();
        log.commitOnePhase(xaTransaction.getIdentifier());
      }
    }
    txStatus.markAsPrepared();
  }
  if (!txStatus.prepared() || txStatus.rollback()) {
    throw new XAException("String_Node_Str" + "String_Node_Str");
  }
  if (!xaTransaction.isReadOnly()) {
    if (!xaTransaction.isRecovered()) {
      if (!onePhase) {
        log.commitTwoPhase(xaTransaction.getIdentifier());
      }
    }
    txStatus.markCommitStarted();
    xaTransaction.commit();
  }
  if (!xaTransaction.isRecovered()) {
    log.done(xaTransaction.getIdentifier());
  }
  xidMap.remove(xid);
  if (xaTransaction.isRecovered()) {
    recoveredTxCount--;
    checkIfRecoveryComplete();
  }
  return xaTransaction;
}
Program: 154859
Project: 154859
Buggy source:
public synchronized void shutdown(){
  if (inShutdown)   return;
  try {
    if (graphDbInstance.started()) {
      sendShutdownEvent();
      extensions.shutdown(log);
    }
    graphDbInstance.shutdown();
  }
  finally {
    inShutdown=false;
  }
}

Fixed version (ground truth):
public synchronized void shutdown(){
  if (inShutdown)   return;
  inShutdown=true;
  try {
    if (graphDbInstance.started()) {
      sendShutdownEvent();
      extensions.shutdown(log);
    }
    graphDbInstance.shutdown();
  }
  finally {
    inShutdown=false;
  }
}
Program: 154860
Project: 154860
Buggy source:
/** 
 * A non-standard way of creating an embedded   {@link GraphDatabaseService}with a set of configuration parameters. Will most likely be removed in future releases.
 * @param storeDir the store directory for the db files
 * @param config configuration parameters
 */
public EmbeddedGraphDbImpl(String storeDir,Map<String,String> config,GraphDatabaseService graphDbService){
  this.storeDir=storeDir;
  graphDbInstance=new GraphDbInstance(storeDir,true);
  final Map<Object,Object> params=graphDbInstance.start(graphDbService,config,kernelPanicEventGenerator,new SyncHookFactory());
  nodeManager=graphDbInstance.getConfig().getGraphDbModule().getNodeManager();
  this.graphDbService=graphDbService;
  this.extensions=new KernelExtension.KernelData(instanceId){
    @Override public String version(){
      return KERNEL_VERSION;
    }
    @Override public Config getConfig(){
      return EmbeddedGraphDbImpl.this.getConfig();
    }
    @Override public Map<Object,Object> getConfigParams(){
      return params;
    }
    @Override public GraphDatabaseService graphDatabase(){
      return EmbeddedGraphDbImpl.this.graphDbService;
    }
  }
;
  initializeExtensions();
}

Fixed version (ground truth):
/** 
 * A non-standard way of creating an embedded   {@link GraphDatabaseService}with a set of configuration parameters. Will most likely be removed in future releases.
 * @param storeDir the store directory for the db files
 * @param config configuration parameters
 */
public EmbeddedGraphDbImpl(String storeDir,Map<String,String> config,GraphDatabaseService graphDbService){
  this.storeDir=storeDir;
  graphDbInstance=new GraphDbInstance(storeDir,true);
  final Map<Object,Object> params=graphDbInstance.start(graphDbService,config,kernelPanicEventGenerator,new SyncHookFactory());
  nodeManager=graphDbInstance.getConfig().getGraphDbModule().getNodeManager();
  this.graphDbService=graphDbService;
  this.extensions=new KernelExtension.KernelData(){
    @Override public String version(){
      return KERNEL_VERSION;
    }
    @Override public Config getConfig(){
      return EmbeddedGraphDbImpl.this.getConfig();
    }
    @Override public Map<Object,Object> getConfigParams(){
      return params;
    }
    @Override public GraphDatabaseService graphDatabase(){
      return EmbeddedGraphDbImpl.this.graphDbService;
    }
  }
;
  extensions.startup(log);
}
Program: 154861
Project: 154861
Buggy source:
public void shutdown(){
  if (graphDbInstance.started()) {
    sendShutdownEvent();
    extensions.shutdown(log);
  }
  graphDbInstance.shutdown();
}

Fixed version (ground truth):
public synchronized void shutdown(){
  if (inShutdown)   return;
  try {
    if (graphDbInstance.started()) {
      sendShutdownEvent();
      extensions.shutdown(log);
    }
    graphDbInstance.shutdown();
  }
  finally {
    inShutdown=false;
  }
}
Program: 154862
Project: 154862
Buggy source:
KernelData(String instanceId){
  this.instanceId=instanceId;
}

Fixed version (ground truth):
KernelData(){
  instanceId=newInstance(this);
}
Program: 154863
Project: 154863
Buggy source:
void shutdown(Logger log){
  for (  KernelExtension loaded : state.keySet()) {
    try {
      loaded.unload(this);
    }
 catch (    Exception ex) {
      log.warning("String_Node_Str" + loaded + "String_Node_Str"+ ex);
    }
  }
}

Fixed version (ground truth):
synchronized void shutdown(Logger log){
  for (  KernelExtension loaded : state.keySet()) {
    try {
      loaded.unload(this);
    }
 catch (    Exception ex) {
      log.warning("String_Node_Str" + loaded + "String_Node_Str"+ ex);
    }
  }
  removeInstance(instanceId);
}
Program: 154864
Project: 154864
Buggy source:
private void setMasterChangeWatcher(int currentMasterId){
  try {
    String root=getRoot();
    String path=root + MASTER_NOTIFY_CHILD;
    byte[] data=null;
    try {
      data=zooKeeper.getData(path,true,null);
      if (data[0] == currentMasterId) {
        return;
      }
    }
 catch (    KeeperException e) {
      if (e.code() != KeeperException.Code.NONODE) {
        throw new ZooKeeperException("String_Node_Str",e);
      }
    }
    try {
      data=new byte[]{(byte)currentMasterId};
      zooKeeper.create(path,data,ZooDefs.Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);
      zooKeeper.setData(path,data,-1);
      System.out.println("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):
private void setMasterChangeWatcher(int currentMasterId){
  try {
    String root=getRoot();
    String path=root + "String_Node_Str" + MASTER_NOTIFY_CHILD;
    byte[] data=null;
    try {
      data=zooKeeper.getData(path,true,null);
      if (data[0] == currentMasterId) {
        return;
      }
    }
 catch (    KeeperException e) {
      if (e.code() != KeeperException.Code.NONODE) {
        throw new ZooKeeperException("String_Node_Str",e);
      }
    }
    try {
      data=new byte[]{(byte)currentMasterId};
      zooKeeper.create(path,data,ZooDefs.Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);
      zooKeeper.setData(path,data,-1);
      System.out.println("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: 154866
Project: 154866
Buggy source:
private void startAsMaster(){
  this.broker=brokerFactory.create();
  this.masterServer=(MasterServer)broker.instantiateMasterServer(this);
  this.localGraph=new EmbeddedGraphDbImpl(storeDir,config,this,CommonFactories.defaultLockManagerFactory(),new MasterIdGeneratorFactory(),CommonFactories.defaultRelationshipTypeCreator(),CommonFactories.defaultTxIdGeneratorFactory(),CommonFactories.defaultTxRollbackHook(),new ZooKeeperLastCommittedTxIdSetter(broker));
  instantiateIndexIfNeeded();
  instantiateAutoUpdatePullerIfConfigSaysSo();
}

Fixed version (ground truth):
private void startAsMaster(){
  this.broker=brokerFactory.create();
  this.localGraph=new EmbeddedGraphDbImpl(storeDir,config,this,CommonFactories.defaultLockManagerFactory(),new MasterIdGeneratorFactory(),CommonFactories.defaultRelationshipTypeCreator(),CommonFactories.defaultTxIdGeneratorFactory(),CommonFactories.defaultTxRollbackHook(),new ZooKeeperLastCommittedTxIdSetter(broker));
  this.masterServer=(MasterServer)broker.instantiateMasterServer(this);
  instantiateIndexIfNeeded();
  instantiateAutoUpdatePullerIfConfigSaysSo();
}
Program: 154867
Project: 154867
Buggy source:
private Iterable<Node> get(IndexProvider indexes,AppCommandParser parser,Session session,Output out){
  String index=parser.arguments().get(0);
  String key=parser.arguments().get(1);
  String value=parser.arguments().get(2);
  return indexes.nodeIndex(index,emptyConfig()).get(key,value);
}

Fixed version (ground truth):
private Iterable<Node> get(IndexProvider indexes,AppCommandParser parser){
  String index=parser.arguments().get(0);
  String key=parser.arguments().get(1);
  String value=parser.arguments().get(2);
  return indexes.nodeIndex(index,emptyConfig()).get(key,value);
}
Program: 154868
Project: 154868
Buggy source:
private Iterable<Node> query(IndexProvider indexes,AppCommandParser parser,Session session,Output out){
  String index=parser.arguments().get(0);
  String query=parser.arguments().get(1);
  return indexes.nodeIndex(index,emptyConfig()).query(query);
}

Fixed version (ground truth):
private Iterable<Node> query(IndexProvider indexes,AppCommandParser parser){
  String index=parser.arguments().get(0);
  String query=parser.arguments().get(1);
  return indexes.nodeIndex(index,emptyConfig()).query(query);
}
Program: 154869
Project: 154869
Buggy source:
private void index(IndexProvider indexes,AppCommandParser parser,Session session,Output out) throws ShellException {
  Node node=getCurrent(session).asNode();
  String index=parser.arguments().get(0);
  String key=parser.arguments().get(0);
  Object value=parser.arguments().size() > 1 ? parser.arguments().get(1) : node.getProperty(key,null);
  if (value == null) {
    throw new ShellException("String_Node_Str");
  }
  indexes.nodeIndex(index,emptyConfig()).add(node,key,value);
}

Fixed version (ground truth):
private void index(IndexProvider indexes,AppCommandParser parser,Session session) throws ShellException {
  Node node=getCurrent(session).asNode();
  String index=parser.arguments().get(0);
  String key=parser.arguments().get(1);
  Object value=parser.arguments().size() > 2 ? parser.arguments().get(2) : node.getProperty(key,null);
  if (value == null) {
    throw new ShellException("String_Node_Str");
  }
  indexes.nodeIndex(index,emptyConfig()).add(node,key,value);
}
Program: 154871
Project: 154871
Buggy source:
private void remove(IndexProvider indexes,AppCommandParser parser,Session session,Output out) throws ShellException {
  Node node=getCurrent(session).asNode();
  String index=parser.arguments().get(0);
  String key=parser.arguments().get(0);
  Object value=parser.arguments().size() > 1 ? parser.arguments().get(1) : node.getProperty(key,null);
  if (value == null) {
    throw new ShellException("String_Node_Str");
  }
  indexes.nodeIndex(index,emptyConfig()).remove(node,key,value);
}

Fixed version (ground truth):
private void remove(IndexProvider indexes,AppCommandParser parser,Session session) throws ShellException {
  Node node=getCurrent(session).asNode();
  String index=parser.arguments().get(0);
  String key=parser.arguments().get(0);
  Object value=parser.arguments().size() > 1 ? parser.arguments().get(1) : node.getProperty(key,null);
  if (value == null) {
    throw new ShellException("String_Node_Str");
  }
  indexes.nodeIndex(index,emptyConfig()).remove(node,key,value);
}
Program: 154872
Project: 154872
Buggy source:
@Override protected void shutdown(){
  this.tryUnexport(this.out);
}

Fixed version (ground truth):
@Override protected void shutdown(){
  this.tryUnexport(this.out);
  if (session.writer != null)   this.tryUnexport(session.writer);
}
Program: 154873
Project: 154873
Buggy source:
public void set(String key,Serializable value){
  if (value == null) {
    this.properties.remove(key);
  }
 else {
    this.properties.put(key,value);
  }
}

Fixed version (ground truth):
public void set(String key,Serializable value){
  try {
    if (writer != null)     writer.set(key,value);
  }
 catch (  RemoteException swallowed) {
  }
  setProperty(properties,key,value);
}
Program: 154874
Project: 154874
Buggy source:
public synchronized int getMaster(){
  try {
    String root=getRoot();
    List<String> children=zooKeeper.getChildren(root,false);
    int currentMasterId=-1;
    int lowestSeq=Integer.MAX_VALUE;
    long highestTxId=-1;
    for (    String child : children) {
      int index=child.indexOf('_');
      int id=Integer.parseInt(child.substring(0,index));
      int seq=Integer.parseInt(child.substring(index + 1));
      try {
        byte[] data=zooKeeper.getData(root + "String_Node_Str" + child,false,null);
        ByteBuffer buf=ByteBuffer.wrap(data);
        long tx=buf.getLong();
        if (tx >= highestTxId) {
          highestTxId=tx;
          if (seq < lowestSeq) {
            currentMasterId=id;
            lowestSeq=seq;
          }
        }
      }
 catch (      KeeperException inner) {
        if (inner.code() != KeeperException.Code.NONODE) {
          throw new ZooKeeperException("String_Node_Str",inner);
        }
      }
    }
    return currentMasterId;
  }
 catch (  KeeperException e) {
    throw new ZooKeeperException("String_Node_Str",e);
  }
catch (  InterruptedException e) {
    Thread.interrupted();
    throw new ZooKeeperException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public synchronized int getMaster(){
  try {
    String root=getRoot();
    List<String> children=zooKeeper.getChildren(root,false);
    int currentMasterId=-1;
    int lowestSeq=Integer.MAX_VALUE;
    long highestTxId=-1;
    for (    String child : children) {
      int index=child.indexOf('_');
      int id=Integer.parseInt(child.substring(0,index));
      int seq=Integer.parseInt(child.substring(index + 1));
      try {
        byte[] data=zooKeeper.getData(root + "String_Node_Str" + child,false,null);
        ByteBuffer buf=ByteBuffer.wrap(data);
        long tx=buf.getLong();
        if (tx >= highestTxId) {
          if (tx > highestTxId || seq < lowestSeq) {
            currentMasterId=id;
            lowestSeq=seq;
          }
          highestTxId=tx;
        }
      }
 catch (      KeeperException inner) {
        if (inner.code() != KeeperException.Code.NONODE) {
          throw new ZooKeeperException("String_Node_Str",inner);
        }
      }
    }
    return currentMasterId;
  }
 catch (  KeeperException e) {
    throw new ZooKeeperException("String_Node_Str",e);
  }
catch (  InterruptedException e) {
    Thread.interrupted();
    throw new ZooKeeperException("String_Node_Str",e);
  }
}
Program: 154875
Project: 154875
Buggy source:
public synchronized void setLastCommittedTx(long txId){
  long current=getRecord(3);
  if ((current + 1) != txId && !isInRecoveryMode()) {
    throw new InvalidRecordException("String_Node_Str" + txId + "String_Node_Str"+ current+ "String_Node_Str");
  }
  setRecord(3,txId);
  if (lastCommittedTxIdSetter != null && !isInRecoveryMode() && txId == getLastCommittedTx() + 1) {
    lastCommittedTxIdSetter.setLastCommittedTxId(txId);
  }
}

Fixed version (ground truth):
public synchronized void setLastCommittedTx(long txId){
  long current=getRecord(3);
  if ((current + 1) != txId && !isInRecoveryMode()) {
    throw new InvalidRecordException("String_Node_Str" + txId + "String_Node_Str"+ current+ "String_Node_Str");
  }
  setRecord(3,txId);
  if (lastCommittedTxIdSetter != null && txId == getLastCommittedTx() + 1) {
    lastCommittedTxIdSetter.setLastCommittedTxId(txId);
  }
}