nus-yam/ex-repair huggingface dataset:
Program: 132428
Project: 132428
Buggy source:
/** 
 * Checks the last insert group of consistency.
 * @throws Exception
 */
private static void performConsistencyCheck() throws Exception {
  LSN last=DBS.replication_pause();
  if (last != null) {
    LookupGroup lookupGroup=generator.getLookupGroup(last);
    for (int i=0; i < lookupGroup.size(); i++) {
      byte[] value=DBS.hiddenLookup(lookupGroup.dbName,lookupGroup.getIndex(i),lookupGroup.getKey(i));
      if (!new String(value).equals(new String(lookupGroup.getValue(i)))) {
        System.err.println("String_Node_Str" + last.toString() + "String_Node_Str"+ "String_Node_Str"+ new String(value)+ "String_Node_Str"+ new String(lookupGroup.getValue(i)));
        System.exit(1);
      }
    }
    System.out.println("String_Node_Str" + last.toString() + "String_Node_Str");
  }
  DBS.replication_resume();
}

Fixed version (ground truth):
/** 
 * Checks the last insert group of consistency.
 * @throws Exception
 */
private static void performConsistencyCheck() throws Exception {
  LSN last=DBS.replication_pause();
  if (last != null) {
    LookupGroup lookupGroup=generator.getLookupGroup(last);
    for (int i=0; i < lookupGroup.size(); i++) {
      byte[] value=DBS.hiddenLookup(lookupGroup.dbName,lookupGroup.getIndex(i),lookupGroup.getKey(i));
      if (!new String(value).equals(new String(lookupGroup.getValue(i)))) {
        System.err.println("String_Node_Str" + last.toString() + "String_Node_Str"+ "String_Node_Str"+ new String(value)+ "String_Node_Str"+ new String(lookupGroup.getValue(i)));
        System.exit(1);
      }
    }
    System.out.println("String_Node_Str" + last.toString() + "String_Node_Str");
  }
 else   System.err.println("String_Node_Str");
  DBS.replication_resume();
}
Program: 132429
Project: 132429
Buggy source:
/** 
 * Restarts the BabuDB. Remains stopped a random down-time.
 * @param master
 * @param slaves
 * @throws IOException
 * @throws InterruptedException
 * @throws BabuDBException
 */
private static void performRestart(Random random,InetSocketAddress master,List<InetSocketAddress> slaves) throws IOException, InterruptedException, BabuDBException {
  DBS.shutdown();
  int downTime=random.nextInt(MAX_DOWN_TIME - MIN_DOWN_TIME) + MIN_DOWN_TIME;
  System.out.println("String_Node_Str" + downTime / 60000 + "String_Node_Str");
  Thread.sleep(downTime);
  DBS=(BabuDBImpl)BabuDBFactory.getSlaveBabuDB(PATH,PATH,NUM_WKS,1,0,SyncMode.ASYNC,0,0,master,slaves,Replication.SLAVE_PORT,null,Replication.DEFAULT_MAX_Q);
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Restarts the BabuDB. Remains stopped a random down-time.
 * @param master
 * @param slaves
 * @throws IOException
 * @throws InterruptedException
 * @throws BabuDBException
 */
private static void performRestart(Random random,InetSocketAddress master,List<InetSocketAddress> slaves) throws IOException, InterruptedException, BabuDBException {
  DBS.shutdown();
  int downTime=random.nextInt(MAX_DOWN_TIME - MIN_DOWN_TIME) + MIN_DOWN_TIME;
  System.out.println("String_Node_Str" + downTime / 60000 + "String_Node_Str");
  Thread.sleep(downTime);
  DBS=(BabuDBImpl)BabuDBFactory.getSlaveBabuDB(PATH,PATH,NUM_WKS,1,0,SyncMode.ASYNC,0,0,master,slaves,Replication.SLAVE_PORT,null,Replication.DEFAULT_MAX_Q);
}
Program: 132431
Project: 132431
Buggy source:
/** 
 * Restarts the BabuDB with complete data-loss. Remains stopped a random down-time.
 * @param master
 * @param slaves
 * @throws IOException
 * @throws InterruptedException
 * @throws BabuDBException
 */
private static void performCleanAndRestart(Random random,InetSocketAddress master,List<InetSocketAddress> slaves) throws IOException, InterruptedException, BabuDBException {
  DBS.shutdown();
  int downTime=random.nextInt(MAX_DOWN_TIME - MIN_DOWN_TIME) + MIN_DOWN_TIME;
  System.out.println("String_Node_Str" + downTime / 60000 + "String_Node_Str");
  Thread.sleep(downTime);
  Process p=Runtime.getRuntime().exec("String_Node_Str" + PATH);
  p.waitFor();
  DBS=(BabuDBImpl)BabuDBFactory.getSlaveBabuDB(PATH,PATH,NUM_WKS,1,0,SyncMode.ASYNC,0,0,master,slaves,Replication.SLAVE_PORT,null,Replication.DEFAULT_MAX_Q);
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Restarts the BabuDB with complete data-loss. Remains stopped a random down-time.
 * @param master
 * @param slaves
 * @throws IOException
 * @throws InterruptedException
 * @throws BabuDBException
 */
private static void performCleanAndRestart(Random random,InetSocketAddress master,List<InetSocketAddress> slaves) throws IOException, InterruptedException, BabuDBException {
  DBS.shutdown();
  int downTime=random.nextInt(MAX_DOWN_TIME - MIN_DOWN_TIME) + MIN_DOWN_TIME;
  System.out.println("String_Node_Str" + downTime / 60000 + "String_Node_Str");
  Thread.sleep(downTime);
  Process p=Runtime.getRuntime().exec("String_Node_Str" + PATH);
  p.waitFor();
  DBS=(BabuDBImpl)BabuDBFactory.getSlaveBabuDB(PATH,PATH,NUM_WKS,1,0,SyncMode.ASYNC,0,0,master,slaves,Replication.SLAVE_PORT,null,Replication.DEFAULT_MAX_Q);
}
Program: 132432
Project: 132432
Buggy source:
public LSN switchLogFile(boolean incrementViewId) throws IOException {
  if (!sync.isHeldByCurrentThread()) {
    throw new IllegalStateException("String_Node_Str");
  }
  LSN lastSyncedLSN=new LSN(this.currentViewId.get(),this.nextLogSequenceNo.get() - 1);
  final String newFileName=createLogFileName();
  channel.close();
  fos.close();
  currentLogFileName=newFileName;
  File lf=new File(this.currentLogFileName);
  String openMode="String_Node_Str";
switch (syncMode) {
case ASYNC:
    break;
case FSYNC:
  break;
case FDATASYNC:
{
  openMode="String_Node_Str";
  break;
}
case SYNC_WRITE:
{
openMode="String_Node_Str";
break;
}
case SYNC_WRITE_METADATA:
{
openMode="String_Node_Str";
break;
}
}
fos=new RandomAccessFile(lf,openMode);
fos.setLength(0);
channel=fos.getChannel();
fdes=fos.getFD();
Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + currentLogFileName);
if (incrementViewId) {
this.currentViewId.incrementAndGet();
this.nextLogSequenceNo.set(1L);
}
return lastSyncedLSN;
}

Fixed version (ground truth):
public LSN switchLogFile(boolean incrementViewId) throws IOException {
  if (!sync.isHeldByCurrentThread()) {
    throw new IllegalStateException("String_Node_Str");
  }
  LSN lastSyncedLSN=new LSN(this.currentViewId.get(),this.nextLogSequenceNo.get() - 1);
  final String newFileName=createLogFileName();
  channel.close();
  fos.close();
  currentLogFileName=newFileName;
  File lf=new File(this.currentLogFileName);
  String openMode="String_Node_Str";
switch (syncMode) {
case ASYNC:
case FSYNC:
case FDATASYNC:
{
      openMode="String_Node_Str";
      break;
    }
case SYNC_WRITE:
{
    openMode="String_Node_Str";
    break;
  }
case SYNC_WRITE_METADATA:
{
  openMode="String_Node_Str";
  break;
}
}
fos=new RandomAccessFile(lf,openMode);
fos.setLength(0);
channel=fos.getChannel();
fdes=fos.getFD();
Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + currentLogFileName);
if (incrementViewId) {
this.currentViewId.incrementAndGet();
this.nextLogSequenceNo.set(1L);
}
return lastSyncedLSN;
}
Program: 132433
Project: 132433
Buggy source:
/** 
 * <p>For replication purpose.</p> <p>A master can mark the LSN as recommended for the next checkpoint, if all slaves have acknowledged replicas until LSN.</p>
 * @param lsn
 */
public synchronized void designateRecommendedCheckpoint(LSN lsn){
  this.recommended=lsn;
}

Fixed version (ground truth):
/** 
 * <p>For replication purpose.</p> <p>A master can mark the LSN as recommended for the next checkpoint, if all slaves have acknowledged replicas until LSN.</p>
 * @param lsn
 */
public void designateRecommendedCheckpoint(LSN lsn){
  this.recommended=lsn;
}
Program: 132434
Project: 132434
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void insertFinished(Object context){
  try {
    if (context == null) {
      String msg="String_Node_Str";
      Logging.logMessage(Logging.LEVEL_ERROR,this,msg);
      dbInterface.replication_runtime_failure(msg);
    }
    Status<Request> rq=(Status<Request>)context;
    updateLastWrittenLSN(rq.getValue().getLSN());
    replication.enqueueRequest(RequestPreProcessor.getACK_RQ(rq.getValue().getLSN(),rq.getValue().getSource()));
    Logging.logMessage(Logging.LEVEL_TRACE,replication,"String_Node_Str" + rq.getValue().getLSN().toString());
    rq.finished();
  }
 catch (  ReplicationException e) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str" + e.getMessage());
    dbInterface.replication_runtime_failure(e.getMessage());
  }
catch (  Exception e) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,e.getMessage());
    dbInterface.replication_runtime_failure(e.getMessage());
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void insertFinished(Object context){
  try {
    if (context == null) {
      String msg="String_Node_Str";
      Logging.logMessage(Logging.LEVEL_ERROR,this,msg);
      dbInterface.replication_runtime_failure(msg);
    }
    Status<Request> rq=(Status<Request>)context;
    updateLastWrittenLSN(rq.getValue().getLSN());
    replication.enqueueRequest(RequestPreProcessor.getACK_RQ(rq.getValue().getLSN(),rq.getValue().getSource()));
    Logging.logMessage(Logging.LEVEL_INFO,replication,"String_Node_Str" + rq.getValue().getLSN().toString());
    rq.finished();
  }
 catch (  ReplicationException e) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str" + e.getMessage());
    dbInterface.replication_runtime_failure(e.getMessage());
  }
catch (  Exception e) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,e.getMessage());
    dbInterface.replication_runtime_failure(e.getMessage());
  }
}
Program: 132435
Project: 132435
Buggy source:
/** 
 * <p>Initializes the   {@link Hashtable} with <code>slaves</code> with LSN "0:0" as initial acknowledged LSN.</p>
 * @param slaves
 */
SlavesStatus(List<InetSocketAddress> slaves){
  super();
  if (slaves != null) {
    for (    InetSocketAddress slave : slaves)     put(slave.getAddress(),new LSN(0,0));
    statusListener=new Hashtable<InetSocketAddress,List<Status<Request>>>(slaves.size());
  }
 else   statusListener=new Hashtable<InetSocketAddress,List<Status<Request>>>();
  latestCommon=new LSN(0,0);
}

Fixed version (ground truth):
/** 
 * <p>Initializes the   {@link Hashtable} with <code>slaves</code> with LSN "0:0" as initial acknowledged LSN.</p>
 * @param slaves
 */
SlavesStatus(List<InetSocketAddress> slaves){
  super();
  if (slaves != null) {
    for (    InetSocketAddress slave : slaves)     put(slave,new LSN(0,0));
    statusListener=new Hashtable<InetSocketAddress,List<Status<Request>>>(slaves.size());
  }
 else   statusListener=new Hashtable<InetSocketAddress,List<Status<Request>>>();
  latestCommon=new LSN(0,0);
}
Program: 132436
Project: 132436
Buggy source:
/** 
 * <p>Updates the latest acknowledged   {@link LSN} of a <code>slave</code>.</p><p>Compares all  {@link LSN}s if necessary, and updates the latest common acknowledged   {@link LSN}.</p> <p>Notify's the listener if set.</p>
 * @param slave
 * @param acknowledgedLSN
 * @return <code>true</code>, if the latestCommon {@link LSN} has changed, <code>false</code> otherwise.
 * @throws ReplicationException 
 */
synchronized boolean update(InetAddress slave,LSN acknowledgedLSN) throws ReplicationException {
  if (get(slave) != null) {
    if (get(slave).compareTo(acknowledgedLSN) < 0) {
      put(slave,acknowledgedLSN);
      LSN latestCommon=acknowledgedLSN;
      for (      LSN lsn : values()) {
        latestCommon=(lsn.compareTo(latestCommon) < 0) ? lsn : latestCommon;
      }
      if (!this.latestCommon.equals(latestCommon)) {
        this.latestCommon=latestCommon;
        return true;
      }
    }
  }
 else {
    put(slave,acknowledgedLSN);
    if (this.latestCommon.compareTo(acknowledgedLSN) > 0) {
      this.latestCommon=acknowledgedLSN;
      return true;
    }
  }
  List<Status<Request>> listeners=statusListener.get(slave);
  if (listeners != null && !listeners.isEmpty()) {
    Collection<Status<Request>> ready=new HashSet<Status<Request>>();
    for (    Status<Request> listener : listeners) {
      if (listener.getValue().getLSN().compareTo(acknowledgedLSN) <= 0) {
        listener.finished();
        ready.add(listener);
      }
    }
    listeners.removeAll(ready);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * <p>Updates the latest acknowledged   {@link LSN} of a <code>slave</code>.</p><p>Compares all  {@link LSN}s if necessary, and updates the latest common acknowledged   {@link LSN}.</p> <p>Notify's the listener if set.</p>
 * @param slave
 * @param acknowledgedLSN
 * @return <code>true</code>, if the latestCommon {@link LSN} has changed, <code>false</code> otherwise.
 * @throws ReplicationException 
 */
synchronized boolean update(InetSocketAddress slave,LSN acknowledgedLSN) throws ReplicationException {
  if (get(slave) != null) {
    if (get(slave).compareTo(acknowledgedLSN) < 0) {
      put(slave,acknowledgedLSN);
      LSN latestCommon=acknowledgedLSN;
      for (      LSN lsn : values()) {
        latestCommon=(lsn.compareTo(latestCommon) < 0) ? lsn : latestCommon;
      }
      if (!this.latestCommon.equals(latestCommon)) {
        this.latestCommon=latestCommon;
        return true;
      }
    }
  }
 else {
    put(slave,acknowledgedLSN);
    if (this.latestCommon.compareTo(acknowledgedLSN) > 0) {
      this.latestCommon=acknowledgedLSN;
      return true;
    }
  }
  List<Status<Request>> listeners=statusListener.get(slave);
  if (listeners != null && !listeners.isEmpty()) {
    Collection<Status<Request>> ready=new HashSet<Status<Request>>();
    for (    Status<Request> listener : listeners) {
      if (listener.getValue().getLSN().compareTo(acknowledgedLSN) <= 0) {
        listener.finished();
        ready.add(listener);
      }
    }
    listeners.removeAll(ready);
  }
  return false;
}
Program: 132437
Project: 132437
Buggy source:
/** 
 * Decreases the counter for expectable sub-requests.
 * @return true, if counter was decreased to 0, false otherwise.
 */
private boolean decreaseMinExpectableResp(){
  int remainingExpected=minExpectableResp.decrementAndGet();
  int remainingReceivable=maxReceivableResp.decrementAndGet();
  return remainingExpected == 0 || (remainingReceivable == 0 && remainingExpected < 0);
}

Fixed version (ground truth):
/** 
 * <p>Decreases the counter for expectable sub-requests.<br> This function is used in the case, that the request succeeds.</p>
 * @return true, if counter was decreased to 0, false otherwise.
 */
private boolean decreaseMinExpectableResp(){
  int remainingExpected=minExpectableResp.decrementAndGet();
  int remainingReceivable=maxReceivableResp.decrementAndGet();
  return remainingExpected == -1 || (remainingExpected == 0 && remainingReceivable >= 0);
}
Program: 132438
Project: 132438
Buggy source:
/** 
 * <p>Sets the request's status to pending and reorders the queue it is in.</p>
 * @throws ReplicationException if status could not be changed.
 */
void pending() throws ReplicationException {
  state.set(PENDING);
  statusListener.statusChanged(this);
}

Fixed version (ground truth):
/** 
 * <p>Sets the request's status to pending and reorders the queue it is in.</p>
 * @throws ReplicationException if status could not be changed.
 */
void pending() throws ReplicationException {
synchronized (state) {
    state.set(PENDING);
    statusListener.statusChanged(this);
  }
}
Program: 132439
Project: 132439
Buggy source:
/** 
 * Decreases the counter for receivable sub-requests by <code>count</code>.
 * @param count
 * @return true, if the maximal number of receivable responses is GE than the minimal number of ACKs expected by the application. false otherwise 
 */
private boolean decreaseMaxReceivableResp(){
}

Fixed version (ground truth):
/** 
 * <p>Decreases the counter for receivable sub-requests by <code>count</code>.<br> This function is used in the case, that the request fails.</p>
 * @param count
 * @return true, if the maximal number of receivable responses is GE than the minimal number of ACKs expected by the application. false otherwise. 
 */
private boolean decreaseMaxReceivableResp(){
}
Program: 132440
Project: 132440
Buggy source:
/** 
 * <p>Resets the state of the actual request.</p>
 * @throws ReplicationException if status could not be changed.
 */
void retry() throws ReplicationException {
  state.set(OPEN);
  maxReceivableResp.set(1);
  minExpectableResp.set(0);
  statusListener.statusChanged(this);
}

Fixed version (ground truth):
/** 
 * <p>Resets the state of the actual request.</p>
 * @throws ReplicationException if status could not be changed.
 */
void retry() throws ReplicationException {
synchronized (state) {
    state.set(OPEN);
    maxReceivableResp.set(1);
    minExpectableResp.set(0);
    statusListener.statusChanged(this);
  }
}
Program: 132442
Project: 132442
Buggy source:
/** 
 * @return the byte-range beginning position.
 */
public long getBegin(){
  return begin;
}

Fixed version (ground truth):
/** 
 * @return the byte-range beginning position.
 */
long getBegin(){
  return begin;
}
Program: 132443
Project: 132443
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + fileName + "String_Node_Str"+ begin+ "String_Node_Str"+ end+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + fileName + "String_Node_Str"+ begin+ "String_Node_Str"+ end+ "String_Node_Str"+ "String_Node_Str"+ ((data == null) ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str";
}
Program: 132444
Project: 132444
Buggy source:
/** 
 * <p>Converts the given <code>json</code> back to a   {@link Chunk}.</p>
 * @param json
 */
Chunk(List<Object> json){
}

Fixed version (ground truth):
/** 
 * <p>Allocates the given range (<code>r1</code>,<code>r2</code>) in the correct order to begin and end of the byte range of file with <code>fName</code>.</p>
 * @param fName
 * @param r1
 * @param r2
 */
Chunk(String fName,long r1,long r2){
}
Program: 132445
Project: 132445
Buggy source:
/** 
 * @return the byte-range ending position.
 */
public long getEnd(){
  return end;
}

Fixed version (ground truth):
/** 
 * @return the byte-range ending position.
 */
long getEnd(){
  return end;
}
Program: 132446
Project: 132446
Buggy source:
/** 
 * @return the fileName, where the chunk is located at.
 */
public String getFileName(){
  return fileName;
}

Fixed version (ground truth):
/** 
 * @return the fileName, where the chunk is located at.
 */
String getFileName(){
  return fileName;
}
Program: 132447
Project: 132447
Buggy source:
@Override public int compare(Status<T> o1,Status<T> o2){
  if ((o1.isPending() && o2.isPending()) || (!o1.isPending() && !o2.isPending())) {
    if (o1.getValue() instanceof Request) {
      Request rq1=(Request)o1.getValue();
      Request rq2=(Request)o2.getValue();
      if (rq2 == null)       return +1;
      Token rq1t=rq1.getToken();
      Token rq2t=rq2.getToken();
      if (rq1t.compareTo(rq2t) == 0) {
switch (rq1t) {
case ACK:
          return rq2.getLSN().compareTo(rq1.getLSN());
case RQ:
        return rq1.getLSN().compareTo(rq2.getLSN());
case REPLICA_BROADCAST:
      return rq1.getLSN().compareTo(rq2.getLSN());
case CHUNK:
    return rq1.getChunkDetails().compareTo(rq2.getChunkDetails());
case ACK_RQ:
  if (rq1.getLSN().equals(rq2.getLSN()))   return -1;
 else   return rq1.getLSN().compareTo(rq2.getLSN());
case REPLICA:
return rq1.getLSN().compareTo(rq2.getLSN());
case CHUNK_RP:
return rq1.getChunkDetails().compareTo(rq2.getChunkDetails());
default :
return 0;
}
}
return rq1t.compareTo(rq2t);
}
 else if (o1.getValue() instanceof LSN) {
LSN lsn1=(LSN)o1.getValue();
LSN lsn2=(LSN)o2.getValue();
return lsn1.compareTo(lsn2);
}
 else if (o1.getValue() instanceof Chunk) {
Chunk chunk1=(Chunk)o1.getValue();
Chunk chunk2=(Chunk)o2.getValue();
return chunk1.compareTo(chunk2);
}
 else return +1;
}
 else if (o1.isPending()) return +1;
 else return -1;
}

Fixed version (ground truth):
@Override public int compare(Status<T> o1,Status<T> o2){
  if ((o1.isPending() && o2.isPending()) || (!o1.isPending() && !o2.isPending())) {
    if (o1.getValue() instanceof Request) {
      Request rq1=(Request)o1.getValue();
      Request rq2=(Request)o2.getValue();
      if (rq2 == null)       return +1;
      Token rq1t=rq1.getToken();
      Token rq2t=rq2.getToken();
      if (rq1t.compareTo(rq2t) == 0) {
switch (rq1t) {
case ACK:
          return rq2.getLSN().compareTo(rq1.getLSN());
case RQ:
        return rq1.getLSN().compareTo(rq2.getLSN());
case REPLICA_BROADCAST:
      return rq1.getLSN().compareTo(rq2.getLSN());
case CHUNK:
    return rq1.getChunk().compareTo(rq2.getChunk());
case ACK_RQ:
  if (rq1.getLSN().equals(rq2.getLSN()))   return -1;
 else   return rq1.getLSN().compareTo(rq2.getLSN());
case REPLICA:
return rq1.getLSN().compareTo(rq2.getLSN());
case CHUNK_RP:
return rq1.getChunk().compareTo(rq2.getChunk());
default :
return 0;
}
}
return rq1t.compareTo(rq2t);
}
 else if (o1.getValue() instanceof LSN) {
LSN lsn1=(LSN)o1.getValue();
LSN lsn2=(LSN)o2.getValue();
return lsn1.compareTo(lsn2);
}
 else if (o1.getValue() instanceof Chunk) {
Chunk chunk1=(Chunk)o1.getValue();
Chunk chunk2=(Chunk)o2.getValue();
return chunk1.compareTo(chunk2);
}
 else return +1;
}
 else if (o1.isPending()) return +1;
 else return -1;
}
Program: 132448
Project: 132448
Buggy source:
/** 
 * sets the inner state
 * @param c
 */
public void switchCondition(CONDITION c){
  this.condition=c;
  Logging.logMessage(Logging.LEVEL_TRACE,this,"String_Node_Str" + c.toString() + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * sets the inner state
 * @param c
 */
void switchCondition(CONDITION c){
  this.condition=c;
  Logging.logMessage(Logging.LEVEL_TRACE,this,"String_Node_Str" + c.toString() + "String_Node_Str");
}
Program: 132449
Project: 132449
Buggy source:
/** 
 * @return the inner state
 */
public CONDITION getCondition(){
  return this.condition;
}

Fixed version (ground truth):
/** 
 * @return the inner state
 */
CONDITION getCondition(){
  return this.condition;
}
Program: 132450
Project: 132450
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void insertFinished(Object context){
  try {
    if (context == null) {
      String msg="String_Node_Str";
      Logging.logMessage(Logging.LEVEL_ERROR,this,msg);
      dbInterface.replication_runtime_failure(msg);
    }
    Status<Request> rq=(Status<Request>)context;
    updateLastWrittenLSN(rq.getValue().getLSN());
    replication.enqueueRequest(RequestPreProcessor.getACK_RQ(rq.getValue().getLSN(),rq.getValue().getSource()));
    if ((rq.getValue().getLSN().getSequenceNo() % 10) == 0)     Logging.logMessage(Logging.LEVEL_ERROR,replication,"String_Node_Str" + rq.getValue().getLSN().toString());
    rq.finished();
  }
 catch (  ReplicationException e) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str" + e.getMessage());
    dbInterface.replication_runtime_failure(e.getMessage());
  }
catch (  Exception e) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,e.getMessage());
    dbInterface.replication_runtime_failure(e.getMessage());
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void insertFinished(Object context){
  try {
    if (context == null) {
      String msg="String_Node_Str";
      Logging.logMessage(Logging.LEVEL_ERROR,this,msg);
      dbInterface.replication_runtime_failure(msg);
    }
    Status<Request> rq=(Status<Request>)context;
    updateLastWrittenLSN(rq.getValue().getLSN());
    replication.enqueueRequest(RequestPreProcessor.getACK_RQ(rq.getValue().getLSN(),rq.getValue().getSource()));
    Logging.logMessage(Logging.LEVEL_TRACE,replication,"String_Node_Str" + rq.getValue().getLSN().toString());
    rq.finished();
  }
 catch (  ReplicationException e) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str" + e.getMessage());
    dbInterface.replication_runtime_failure(e.getMessage());
  }
catch (  Exception e) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,e.getMessage());
    dbInterface.replication_runtime_failure(e.getMessage());
  }
}
Program: 132452
Project: 132452
Buggy source:
/** 
 * Deletes a key-value pair. This method is equivalent to <code>insert(key, null)</code>.
 * @param key the key
 */
public void delete(byte[] key){
  overlay.insert(key,null);
}

Fixed version (ground truth):
/** 
 * Deletes a key-value pair. This method is equivalent to <code>insert(key, null)</code>.
 * @param key the key
 */
public void delete(byte[] key){
synchronized (lock) {
    overlay.insert(key,null);
  }
}
Program: 132453
Project: 132453
Buggy source:
public LSN switchLogFile() throws IOException {
  if (!sync.isHeldByCurrentThread()) {
    throw new IllegalStateException("String_Node_Str");
  }
  LSN lastSyncedLSN=new LSN(this.currentViewId.get(),this.nextLogSequenceNo.get() - 1);
  final String newFileName=createLogFileName();
  channel.close();
  fos.close();
  currentLogFileName=newFileName;
  File lf=new File(this.currentLogFileName);
  String openMode="String_Node_Str";
switch (syncMode) {
case ASYNC:
case FSYNC:
case FDATASYNC:
{
      openMode="String_Node_Str";
      break;
    }
case SYNC_WRITE:
{
    openMode="String_Node_Str";
    break;
  }
case SYNC_WRITE_METADATA:
{
  openMode="String_Node_Str";
  break;
}
}
System.out.println("String_Node_Str" + openMode);
fos=new RandomAccessFile(lf,openMode);
fos.setLength(0);
channel=fos.getChannel();
fdes=fos.getFD();
Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + currentLogFileName);
return lastSyncedLSN;
}

Fixed version (ground truth):
public LSN switchLogFile() throws IOException {
  if (!sync.isHeldByCurrentThread()) {
    throw new IllegalStateException("String_Node_Str");
  }
  LSN lastSyncedLSN=new LSN(this.currentViewId.get(),this.nextLogSequenceNo.get() - 1);
  final String newFileName=createLogFileName();
  channel.close();
  fos.close();
  currentLogFileName=newFileName;
  File lf=new File(this.currentLogFileName);
  String openMode="String_Node_Str";
switch (syncMode) {
case ASYNC:
case FSYNC:
case FDATASYNC:
{
      openMode="String_Node_Str";
      break;
    }
case SYNC_WRITE:
{
    openMode="String_Node_Str";
    break;
  }
case SYNC_WRITE_METADATA:
{
  openMode="String_Node_Str";
  break;
}
}
fos=new RandomAccessFile(lf,openMode);
fos.setLength(0);
channel=fos.getChannel();
fdes=fos.getFD();
Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + currentLogFileName);
return lastSyncedLSN;
}
Program: 132454
Project: 132454
Buggy source:
/** 
 * Links the indices to the latest on-disk snapshot, cleans up any  unnecessary in-memory and on-disk data
 * @param viewId the viewId of the snapshot
 * @param sequenceNo the sequenceNo of the snaphot
 * @throws java.io.IOException if snapshots cannot be cleaned up
 */
public void cleanupSnapshot(final int viewId,final long sequenceNo) throws IOException {
  for (int index=0; index < trees.size(); index++) {
    final LSMTree tree=trees.get(index);
    System.out.println("String_Node_Str" + databaseDir + getSnaphotFilename(index,viewId,sequenceNo));
    tree.linkToSnapshot(databaseDir + getSnaphotFilename(index,viewId,sequenceNo));
    ondiskLSN=new LSN(viewId,sequenceNo);
    File f=new File(databaseDir);
    String[] files=f.list();
    Pattern p=Pattern.compile(SNAPSHOT_FILENAME_REGEXP);
    for (    String fname : files) {
      Matcher m=p.matcher(fname);
      if (m.matches()) {
        int fView=Integer.valueOf(m.group(2));
        int fSeq=Integer.valueOf(m.group(3));
        if ((fView < viewId) || ((fView == viewId) && (fSeq < sequenceNo))) {
          File snap=new File(databaseDir + fname);
          snap.delete();
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Links the indices to the latest on-disk snapshot, cleans up any  unnecessary in-memory and on-disk data
 * @param viewId the viewId of the snapshot
 * @param sequenceNo the sequenceNo of the snaphot
 * @throws java.io.IOException if snapshots cannot be cleaned up
 */
public void cleanupSnapshot(final int viewId,final long sequenceNo) throws IOException {
  for (int index=0; index < trees.size(); index++) {
    final LSMTree tree=trees.get(index);
    if (Logging.isDebug())     Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + databaseDir + getSnaphotFilename(index,viewId,sequenceNo));
    tree.linkToSnapshot(databaseDir + getSnaphotFilename(index,viewId,sequenceNo));
    ondiskLSN=new LSN(viewId,sequenceNo);
    File f=new File(databaseDir);
    String[] files=f.list();
    Pattern p=Pattern.compile(SNAPSHOT_FILENAME_REGEXP);
    for (    String fname : files) {
      Matcher m=p.matcher(fname);
      if (m.matches()) {
        int fView=Integer.valueOf(m.group(2));
        int fSeq=Integer.valueOf(m.group(3));
        if ((fView < viewId) || ((fView == viewId) && (fSeq < sequenceNo))) {
          File snap=new File(databaseDir + fname);
          snap.delete();
        }
      }
    }
  }
}
Program: 132455
Project: 132455
Buggy source:
public static void usage(){
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
public static void usage(){
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.print("String_Node_Str");
  for (  SyncMode tmp : SyncMode.values()) {
    System.out.print(tmp.name() + "String_Node_Str");
  }
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
  System.out.println("String_Node_Str" + "String_Node_Str");
}
Program: 132457
Project: 132457
Buggy source:
public void run(){
  try {
switch (operation) {
case INSERT:
      performInserts();
    break;
case LOOKUP:
  performLookups();
break;
case ITERATE:
countKeys();
break;
}
}
 catch (Exception ex) {
error=ex;
}
synchronized (this) {
done=true;
this.notifyAll();
}
}

Fixed version (ground truth):
public void run(){
  try {
switch (operation) {
case INSERT:
      performInserts();
    break;
case LOOKUP:
  performLookups();
break;
case DIRECT_LOOKUP:
performDirectLookups();
break;
case ITERATE:
countKeys();
break;
case UDL:
performUserDefinedLookups();
break;
}
}
 catch (Exception ex) {
error=ex;
}
synchronized (this) {
done=true;
this.notifyAll();
}
}
Program: 132458
Project: 132458
Buggy source:
/** 
 * Creates a new instance of ConnectionStatus
 * @param channel the channel to which this state object belongs.
 */
public ConnectionState(ChannelIO channel){
  active=new AtomicBoolean(true);
  this.channel=channel;
  data=BufferPool.allocate(BUFFSIZE);
  this.status=STATUS_IDLE;
  waitFor=null;
  sendQ=new LinkedBlockingQueue<SpeedyRequest>(MultiSpeedy.MAX_CLIENT_QUEUE);
  receiveQ=new LinkedList<SpeedyRequest>();
  this.conRetries=0;
  this.numReconnectCycles=0;
  this.lastUsed=TimeSync.getLocalSystemTime();
}

Fixed version (ground truth):
/** 
 * Creates a new instance of ConnectionStatus
 * @param channel the channel to which this state object belongs.
 */
public ConnectionState(ChannelIO channel){
  active=new AtomicBoolean(true);
  this.channel=channel;
  data=BufferPool.allocate(BUFFSIZE);
  this.status=STATUS_IDLE;
  waitFor=null;
  sendQ=new LinkedBlockingQueue<SpeedyRequest>(MultiSpeedy.MAX_CLIENT_QUEUE);
  receiveQ=new LinkedList<SpeedyRequest>();
  this.conRetries=0;
  this.numReconnectCycles=0;
  this.lastUsed=System.currentTimeMillis();
}
Program: 132459
Project: 132459
Buggy source:
public void connectFailed(){
  this.numReconnectCycles++;
  long waitt=Math.round(RETRY_RESET_IN_MS * Math.pow(2,this.numReconnectCycles));
  if (waitt > MAX_RETRY_WAIT)   waitt=MAX_RETRY_WAIT;
  Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + (waitt / 1000) + "String_Node_Str"+ this.numReconnectCycles);
  this.nextReconnectTime=System.currentTimeMillis() + waitt;
  this.lastUsed=TimeSync.getLocalSystemTime();
}

Fixed version (ground truth):
public void connectFailed(){
  this.numReconnectCycles++;
  long waitt=Math.round(RETRY_RESET_IN_MS * Math.pow(2,this.numReconnectCycles));
  if (waitt > MAX_RETRY_WAIT)   waitt=MAX_RETRY_WAIT;
  Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + (waitt / 1000) + "String_Node_Str"+ this.numReconnectCycles);
  this.nextReconnectTime=System.currentTimeMillis() + waitt;
  this.lastUsed=System.currentTimeMillis();
}
Program: 132462
Project: 132462
Buggy source:
/** 
 * Performs a lookup in a given snapshot.
 * @param key the key to look up
 * @param snapId the snapshot ID
 * @return the value associated with the key in the snapshot
 */
public byte[] lookup(byte[] key,int snapId){
  byte[] result=overlay.lookup(key,snapId);
  if (result != null)   return result;
  return index == null ? null : index.lookup(key);
}

Fixed version (ground truth):
/** 
 * Performs a lookup in a given snapshot.
 * @param key the key to look up
 * @param snapId the snapshot ID
 * @return the value associated with the key in the snapshot
 */
public byte[] lookup(byte[] key,int snapId){
  byte[] result=overlay.lookup(key,snapId);
  if (result == NULL_ELEMENT)   return null;
  if (result != null)   return result;
  return index == null ? null : index.lookup(key);
}
Program: 132463
Project: 132463
Buggy source:
/** 
 * Performs a prefix lookup in a given snapshot. Key-value paris are returned in an iterator in ascending key order, where only such keys are returned with a matching prefix according to the comparator.
 * @param prefix the prefix
 * @return an iterator with key-value pairs
 */
public Iterator<Entry<byte[],byte[]>> prefixLookup(byte[] prefix,int snapId){
  if (prefix != null && prefix.length == 0)   prefix=null;
  List<Iterator<Entry<byte[],byte[]>>> list=new ArrayList<Iterator<Entry<byte[],byte[]>>>(2);
  list.add(overlay.prefixLookup(prefix,snapId));
  if (index != null) {
    byte[][] rng=comp.prefixToRange(prefix);
    list.add(index.rangeLookup(rng[0],rng[1]));
  }
  return new OverlayMergeIterator<byte[],byte[]>(list,comp,null);
}

Fixed version (ground truth):
/** 
 * Performs a prefix lookup in a given snapshot. Key-value paris are returned in an iterator in ascending key order, where only such keys are returned with a matching prefix according to the comparator.
 * @param prefix the prefix
 * @return an iterator with key-value pairs
 */
public Iterator<Entry<byte[],byte[]>> prefixLookup(byte[] prefix,int snapId){
  if (prefix != null && prefix.length == 0)   prefix=null;
  List<Iterator<Entry<byte[],byte[]>>> list=new ArrayList<Iterator<Entry<byte[],byte[]>>>(2);
  list.add(overlay.prefixLookup(prefix,snapId,true));
  if (index != null) {
    byte[][] rng=comp.prefixToRange(prefix);
    list.add(index.rangeLookup(rng[0],rng[1]));
  }
  return new OverlayMergeIterator<byte[],byte[]>(list,comp,null);
}
Program: 132464
Project: 132464
Buggy source:
private Entry<K,V> getNextElement(){
  for (; ; ) {
    int smallest=0;
    for (int i=1; i < nextElements.length; i++) {
      if (nextElements[i] == null)       continue;
      if (nextElements[smallest] == null || comp.compare(nextElements[i].getKey(),nextElements[smallest].getKey()) < 0)       smallest=i;
 else       if (comp.compare(nextElements[i].getKey(),nextElements[smallest].getKey()) == 0) {
        Iterator<Entry<K,V>> it=itList.get(i);
        nextElements[i]=it.hasNext() ? it.next() : null;
      }
    }
    Entry<K,V> entry=nextElements[smallest];
    Iterator<Entry<K,V>> it=itList.get(smallest);
    nextElements[smallest]=it.hasNext() ? it.next() : null;
    if (entry == null)     return null;
    if (entry.getValue() != nullValue)     return entry;
  }
}

Fixed version (ground truth):
private Entry<K,V> getNextElement(){
  for (; ; ) {
    int smallest=0;
    for (int i=1; i < nextElements.length; i++) {
      if (nextElements[i] == null)       continue;
      if (nextElements[smallest] == null || comp.compare(nextElements[i].getKey(),nextElements[smallest].getKey()) < 0)       smallest=i;
 else       if (comp.compare(nextElements[i].getKey(),nextElements[smallest].getKey()) == 0) {
        Iterator<Entry<K,V>> it=itList.get(i);
        nextElements[i]=it.hasNext() ? it.next() : null;
      }
    }
    Entry<K,V> entry=nextElements[smallest];
    Iterator<Entry<K,V>> it=itList.get(smallest);
    nextElements[smallest]=it.hasNext() ? it.next() : null;
    if (entry == null)     return null;
    if (nullValue == null || entry.getValue() != nullValue)     return entry;
  }
}
Program: 132465
Project: 132465
Buggy source:
public Iterator<Entry<byte[],byte[]>> prefixLookup(byte[] prefix,int overlayId){
  byte[][] keyRange=comp.prefixToRange(prefix);
  assert(keyRange.length == 2);
  return rangeLookup(keyRange[0],keyRange[1],overlayId);
}

Fixed version (ground truth):
public Iterator<Entry<byte[],byte[]>> prefixLookup(byte[] prefix,int overlayId,boolean includeDeletedEntries){
  byte[][] keyRange=comp.prefixToRange(prefix);
  assert(keyRange.length == 2);
  return rangeLookup(keyRange[0],keyRange[1],overlayId,includeDeletedEntries);
}
Program: 132466
Project: 132466
Buggy source:
public Iterator<Entry<String,V>> prefixLookup(String prefix,int overlayId){
  return rangeLookup(prefix,getNextPrefix(prefix),overlayId);
}

Fixed version (ground truth):
public Iterator<Entry<String,V>> prefixLookup(String prefix,int overlayId,boolean includeDeletedEntries){
  return rangeLookup(prefix,getNextPrefix(prefix),overlayId,includeDeletedEntries);
}
Program: 132467
Project: 132467
Buggy source:
/** 
 * Destroys any read-only overlay trees, such that only the current read-write tree remains.
 */
public void cleanup(){
  overlayMap.clear();
  treeList.next=null;
}

Fixed version (ground truth):
/** 
 * Destroys any read-only overlay trees, such that only the current read-write tree remains.
 */
public void cleanup(){
  overlayMap.clear();
  treeList.next=null;
  overlayId=0;
}
Program: 132468
Project: 132468
Buggy source:
private Iterator<Entry<K,V>> rangeLookup(K from,K to,OverlayTreeList treeList){
  final List<Iterator<Entry<K,V>>> itList=new ArrayList<Iterator<Entry<K,V>>>();
  for (OverlayTreeList list=treeList; list != null; list=list.next) {
    if (from != null && to != null)     itList.add(list.tree.subMap(from,to).entrySet().iterator());
 else     if (from == null && to == null)     itList.add(list.tree.entrySet().iterator());
 else     if (from != null && to == null)     itList.add(list.tree.tailMap(from).entrySet().iterator());
 else     itList.add(list.tree.headMap(to).entrySet().iterator());
  }
  return new OverlayMergeIterator<K,V>(itList,comparator,nullValue);
}

Fixed version (ground truth):
private Iterator<Entry<K,V>> rangeLookup(K from,K to,OverlayTreeList treeList,boolean includeDeletedEntries){
  final List<Iterator<Entry<K,V>>> itList=new ArrayList<Iterator<Entry<K,V>>>();
  for (OverlayTreeList list=treeList; list != null; list=list.next) {
    if (from != null && to != null)     itList.add(list.tree.subMap(from,to).entrySet().iterator());
 else     if (from == null && to == null)     itList.add(list.tree.entrySet().iterator());
 else     if (from != null && to == null)     itList.add(list.tree.tailMap(from).entrySet().iterator());
 else     itList.add(list.tree.headMap(to).entrySet().iterator());
  }
  return new OverlayMergeIterator<K,V>(itList,comparator,includeDeletedEntries ? null : nullValue);
}
Program: 132469
Project: 132469
Buggy source:
/** 
 * Inserts a key-value pair in the LSM tree. If the value is <code>null</code>, the key will be removed.
 * @param key the key
 * @param value the value
 */
public void insert(K key,V value){
  if (value == null) {
    if (overlayId == 0 || lookup(key,overlayId - 1) == null) {
      treeList.tree.remove(key);
    }
 else     treeList.tree.put(key,nullValue);
  }
 else   treeList.tree.put(key,value);
}

Fixed version (ground truth):
/** 
 * Inserts a key-value pair in the LSM tree. If the value is <code>null</code>, the key will be removed.
 * @param key the key
 * @param value the value
 */
public void insert(K key,V value){
  if (value == null)   treeList.tree.put(key,nullValue);
 else   treeList.tree.put(key,value);
}
Program: 132470
Project: 132470
Buggy source:
public CopyDatabaseTest(){
  Logging.start(Logging.LEVEL_DEBUG);
}

Fixed version (ground truth):
public CopyDatabaseTest(){
}
Program: 132471
Project: 132471
Buggy source:
@Before public void setUp() throws Exception {
  Process p=Runtime.getRuntime().exec("String_Node_Str" + baseDir);
  p.waitFor();
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  Logging.start(Logging.LEVEL_DEBUG);
  Process p=Runtime.getRuntime().exec("String_Node_Str" + baseDir);
  p.waitFor();
}
Program: 132472
Project: 132472
Buggy source:
public void setUp(){
  new File(SNAP_FILE).delete();
  new File(SNAP_FILE2).delete();
}

Fixed version (ground truth):
public void setUp(){
  Logging.start(Logging.LEVEL_ERROR);
  new File(SNAP_FILE).delete();
  new File(SNAP_FILE2).delete();
}
Program: 132473
Project: 132473
Buggy source:
@Before public void setUp(){
}

Fixed version (ground truth):
@Before public void setUp(){
  Logging.start(Logging.LEVEL_ERROR);
}
Program: 132477
Project: 132477
Buggy source:
public Iterator<Entry<byte[],byte[]>> directPrefixLookup(String databaseName,int indexId,byte[] key) throws BabuDBException {
  final LSMDatabase db=dbNames.get(databaseName);
  if (db == null) {
    throw new BabuDBException(ErrorCode.NO_SUCH_DB,"String_Node_Str");
  }
  if ((indexId >= db.getIndexCount()) || (indexId < 0)) {
    throw new BabuDBException(ErrorCode.NO_SUCH_INDEX,"String_Node_Str");
  }
  return db.getIndex(indexId).prefixLookup(key);
}

Fixed version (ground truth):
public Iterator<Entry<byte[],byte[]>> directPrefixLookup(String databaseName,int indexId,byte[] key) throws BabuDBException {
  if (isSlave()) {
    throw new BabuDBException(ErrorCode.REPLICATION_FAILURE,slaveProtection);
  }
  final LSMDatabase db=dbNames.get(databaseName);
  if (db == null) {
    throw new BabuDBException(ErrorCode.NO_SUCH_DB,"String_Node_Str");
  }
  if ((indexId >= db.getIndexCount()) || (indexId < 0)) {
    throw new BabuDBException(ErrorCode.NO_SUCH_INDEX,"String_Node_Str");
  }
  return db.getIndex(indexId).prefixLookup(key);
}
Program: 132478
Project: 132478
Buggy source:
public byte[] directLookup(String databaseName,int indexId,byte[] key) throws BabuDBException {
  final LSMDatabase db=dbNames.get(databaseName);
  if (db == null) {
    throw new BabuDBException(ErrorCode.NO_SUCH_DB,"String_Node_Str");
  }
  if ((indexId >= db.getIndexCount()) || (indexId < 0)) {
    throw new BabuDBException(ErrorCode.NO_SUCH_INDEX,"String_Node_Str");
  }
  return db.getIndex(indexId).lookup(key);
}

Fixed version (ground truth):
public byte[] directLookup(String databaseName,int indexId,byte[] key) throws BabuDBException {
  if (isSlave()) {
    throw new BabuDBException(ErrorCode.REPLICATION_FAILURE,slaveProtection);
  }
  final LSMDatabase db=dbNames.get(databaseName);
  if (db == null) {
    throw new BabuDBException(ErrorCode.NO_SUCH_DB,"String_Node_Str");
  }
  if ((indexId >= db.getIndexCount()) || (indexId < 0)) {
    throw new BabuDBException(ErrorCode.NO_SUCH_INDEX,"String_Node_Str");
  }
  return db.getIndex(indexId).lookup(key);
}
Program: 132480
Project: 132480
Buggy source:
@Override public void insertFinished(Object context){
  Status<Request> rq=(Status<Request>)context;
  PinkyRequest orgReq=(PinkyRequest)rq.getValue().getOriginal();
  if (orgReq != null) {
    orgReq.setResponse(HTTPUtils.SC_OKAY);
    replication.sendResponse(orgReq);
  }
 else {
    rq.getValue().free();
    try {
      replication.sendACK(new Status(RequestPreProcessor.getACKRequest(rq.getValue().getLSN(),rq.getValue().getSource())));
    }
 catch (    ReplicationException e) {
      Logging.logMessage(Logging.LEVEL_WARN,this,"String_Node_Str");
    }
  }
  rq.getValue().free();
  replication.removeMissing(rq);
}

Fixed version (ground truth):
@Override public void insertFinished(Object context){
  Status<Request> rq=(Status<Request>)context;
  PinkyRequest orgReq=(PinkyRequest)rq.getValue().getOriginal();
  if (orgReq != null) {
    orgReq.setResponse(HTTPUtils.SC_OKAY);
    replication.sendResponse(orgReq);
  }
 else {
    rq.getValue().free();
    try {
      replication.sendACK(new Status(RequestPreProcessor.getACKRequest(rq.getValue().getLSN(),rq.getValue().getSource())));
    }
 catch (    ReplicationException e) {
      Logging.logMessage(Logging.LEVEL_WARN,this,"String_Node_Str");
    }
  }
synchronized (lock) {
    lastWrittenLSN=(lastWrittenLSN.compareTo(rq.getValue().getLSN()) < 0) ? rq.getValue().getLSN() : lastWrittenLSN;
  }
  rq.getValue().free();
  replication.removeMissing(rq);
}
Program: 132481
Project: 132481
Buggy source:
public ByteRange(ByteBuffer buf,int startOffset,int endOffset){
  this.buf=buf;
  this.startOffset=startOffset;
  this.endOffset=endOffset;
  this.size=endOffset - startOffset;
}

Fixed version (ground truth):
public ByteRange(ByteBuffer buf,int startOffset,int endOffset){
}
Program: 132483
Project: 132483
Buggy source:
public Iterator<Entry<ByteRange,ByteRange>> rangeLookup(byte[] from,byte[] to){
  final int startIndex;
  final int endIndex;
{
    startIndex=keys.getTopPosition(from);
    endIndex=keys.getBottomPosition(to);
  }
  return new Iterator<Entry<ByteRange,ByteRange>>(){
    int currentIndex=startIndex;
    @Override public boolean hasNext(){
      return currentIndex <= endIndex;
    }
    @Override public Entry<ByteRange,ByteRange> next(){
      if (!hasNext())       throw new NoSuchElementException();
      Entry<ByteRange,ByteRange> entry=new Entry<ByteRange,ByteRange>(){
        final ByteRange key=keys.getEntry(currentIndex);
        final ByteRange value=values.getEntry(currentIndex);
        @Override public ByteRange getValue(){
          return value;
        }
        @Override public ByteRange getKey(){
          return key;
        }
        @Override public ByteRange setValue(        ByteRange value){
          throw new UnsupportedOperationException();
        }
      }
;
      currentIndex++;
      return entry;
    }
    @Override public void remove(){
      throw new UnsupportedOperationException();
    }
  }
;
}

Fixed version (ground truth):
public Iterator<Entry<ByteRange,ByteRange>> rangeLookup(byte[] from,byte[] to){
}