Program: 154865
Project: 154865
Buggy source:
public synchronized int getMaster(){
  waitForSyncConnected();
  try {
    Map<Integer,Pair<Integer,Long>> rawData=new HashMap<Integer,Pair<Integer,Long>>();
    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 (rawData.put(id,new Pair<Integer,Long>(seq,tx)) != null) {
          System.out.println("String_Node_Str" + id + "String_Node_Str");
        }
        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);
        }
      }
    }
    System.out.println("String_Node_Str" + currentMasterId + "String_Node_Str"+ rawData);
    setMasterChangeWatcher(currentMasterId);
    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(){
  waitForSyncConnected();
  try {
    Map<Integer,Pair<Integer,Long>> rawData=new HashMap<Integer,Pair<Integer,Long>>();
    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) {
      if (child.equals(MASTER_NOTIFY_CHILD)) {
        continue;
      }
      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 (rawData.put(id,new Pair<Integer,Long>(seq,tx)) != null) {
          System.out.println("String_Node_Str" + id + "String_Node_Str");
        }
        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);
        }
      }
    }
    System.out.println("String_Node_Str" + currentMasterId + "String_Node_Str"+ rawData);
    setMasterChangeWatcher(currentMasterId);
    return currentMasterId;
  }
 catch (  KeeperException e) {
    throw new ZooKeeperException("String_Node_Str",e);
  }
catch (  InterruptedException e) {
    Thread.interrupted();
    throw new ZooKeeperException("String_Node_Str",e);
  }
}