nus-yam/ex-repair huggingface dataset:
Program: 113576
Project: 113576
Buggy source:
@Override public void startRequest(DIRRequest rq){
  final xtreemfs_service_deregisterRequest request=(xtreemfs_service_deregisterRequest)rq.getRequestMessage();
  BabuDBInsertGroup ig;
  try {
    ig=database.createInsertGroup();
  }
 catch (  BabuDBException ex) {
    if (ex.getErrorCode() == ErrorCode.NO_ACCESS && dbsReplicationManager != null)     rq.sendRedirectException(dbsReplicationManager.getMaster());
 else     rq.sendInternalServerError(ex);
    return;
  }
  ig.addDelete(DIRRequestDispatcher.INDEX_ID_SERVREG,request.getUuid().getBytes());
  database.insert(ig,rq).registerListener(new BabuDBRequestListener<Object>(){
    @Override public void finished(    Object arg0,    Object context){
      ((DIRRequest)context).sendSuccess(request.createDefaultResponse());
    }
    @Override public void failed(    BabuDBException e,    Object context){
      Logging.logError(Logging.LEVEL_ERROR,this,e);
      if (e.getErrorCode() == ErrorCode.NO_ACCESS && dbsReplicationManager != null)       ((DIRRequest)context).sendRedirectException(dbsReplicationManager.getMaster());
 else       ((DIRRequest)context).sendInternalServerError(e);
    }
  }
);
}

Fixed version (ground truth):
@Override public void startRequest(DIRRequest rq){
  xtreemfs_service_deregisterRequest request=(xtreemfs_service_deregisterRequest)rq.getRequestMessage();
  BabuDBInsertGroup ig;
  try {
    ig=database.createInsertGroup();
    ig.addDelete(DIRRequestDispatcher.INDEX_ID_SERVREG,request.getUuid().getBytes());
    database.insert(ig,rq).registerListener(new DBRequestListener<Object,Object>(true){
      @Override Object execute(      Object result,      DIRRequest rq) throws Exception {
        return result;
      }
    }
);
  }
 catch (  BabuDBException ex) {
    requestFailed(ex,rq);
    return;
  }
}
Program: 113577
Project: 113577
Buggy source:
public DeregisterServiceOperation(DIRRequestDispatcher master){
  super(master);
  operationNumber=xtreemfs_service_deregisterRequest.TAG;
  database=master.getDirDatabase();
  dbsReplicationManager=master.getDBSReplicationService();
}

Fixed version (ground truth):
public DeregisterServiceOperation(DIRRequestDispatcher master){
  super(master);
  operationNumber=xtreemfs_service_deregisterRequest.TAG;
  database=master.getDirDatabase();
}
Program: 113579
Project: 113579
Buggy source:
/** 
 * resynchronizes with the global time obtained from the DIR
 */
private void resync(){
  if (dir == null)   return;
  RPCResponse<Long> r=null;
  try {
    long tStart=localSysTime;
    long oldDrift=currentDrift;
    r=dir.xtreemfs_global_time_get(null);
    Long globalTime=r.get();
    r.freeBuffers();
    long tEnd=System.currentTimeMillis();
    syncRTT=(int)(tEnd - tStart);
    globalTime+=syncRTT / 2;
    syncSuccess=true;
    currentDrift=globalTime - tEnd;
    lastSync=tEnd;
    if (Math.abs(oldDrift - currentDrift) > 5000 && oldDrift != 0) {
      Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,this,"String_Node_Str",oldDrift,currentDrift);
    }
  }
 catch (  Exception ex) {
    if (r != null) {
      r.freeBuffers();
    }
    syncSuccess=false;
    ex.printStackTrace();
    lastSync=System.currentTimeMillis();
  }
}

Fixed version (ground truth):
/** 
 * resynchronizes with the global time obtained from the DIR
 */
private void resync(){
  if (dir == null)   return;
  RPCResponse<Long> r=null;
  try {
    long tStart=localSysTime;
    long oldDrift=currentDrift;
    r=dir.xtreemfs_global_time_get(null);
    Long globalTime=r.get();
    long tEnd=System.currentTimeMillis();
    syncRTT=(int)(tEnd - tStart);
    globalTime+=syncRTT / 2;
    syncSuccess=true;
    currentDrift=globalTime - tEnd;
    lastSync=tEnd;
    if (Math.abs(oldDrift - currentDrift) > 5000 && oldDrift != 0) {
      Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,this,"String_Node_Str",oldDrift,currentDrift);
    }
  }
 catch (  Exception ex) {
    syncSuccess=false;
    ex.printStackTrace();
    lastSync=System.currentTimeMillis();
  }
 finally {
    if (r != null) {
      r.freeBuffers();
    }
  }
}
Program: 113581
Project: 113581
Buggy source:
@Override public void finished(Iterator<Entry<byte[],byte[]>> iter,Object context){
  try {
    ServiceSet services=new ServiceSet();
    long now=System.currentTimeMillis() / 1000l;
    while (iter.hasNext()) {
      Entry<byte[],byte[]> e=iter.next();
      ServiceRecord servEntry=new ServiceRecord(ReusableBuffer.wrap(e.getValue()));
      if (servEntry.getName().equals(request.getName()))       services.add(servEntry.getService());
      long secondsSinceLastUpdate=now - servEntry.getLast_updated_s();
      servEntry.getData().put("String_Node_Str",Long.toString(secondsSinceLastUpdate));
    }
    ((DIRRequest)context).sendSuccess(request.createDefaultResponse());
  }
 catch (  IOException e) {
    Logging.logError(Logging.LEVEL_ERROR,this,e);
    ((DIRRequest)context).sendInternalServerError(e);
  }
}

Fixed version (ground truth):
@Override public void finished(Iterator<Entry<byte[],byte[]>> iter,Object context){
  try {
    ServiceSet services=new ServiceSet();
    long now=System.currentTimeMillis() / 1000l;
    while (iter.hasNext()) {
      Entry<byte[],byte[]> e=iter.next();
      ServiceRecord servEntry=new ServiceRecord(ReusableBuffer.wrap(e.getValue()));
      if (servEntry.getName().equals(request.getName()))       services.add(servEntry.getService());
      long secondsSinceLastUpdate=now - servEntry.getLast_updated_s();
      servEntry.getData().put("String_Node_Str",Long.toString(secondsSinceLastUpdate));
    }
    xtreemfs_service_get_by_nameResponse response=new xtreemfs_service_get_by_nameResponse(services);
    ((DIRRequest)context).sendSuccess(response);
  }
 catch (  IOException e) {
    Logging.logError(Logging.LEVEL_ERROR,this,e);
    ((DIRRequest)context).sendInternalServerError(e);
  }
}
Program: 113583
Project: 113583
Buggy source:
@Override public int getPosixAccessRights(StorageManager sMan,FileMetadata file,String userId,List<String> groupIds) throws MRCException {
  return file.getPerms();
}

Fixed version (ground truth):
@Override public int getPosixAccessRights(StorageManager sMan,FileMetadata file,String userId,List<String> groupIds) throws MRCException {
  return file.isReadOnly() ? file.getPerms() & READ_ONLY_MASK : file.getPerms();
}
Program: 113584
Project: 113584
Buggy source:
@Override public int getPosixAccessRights(StorageManager sMan,FileMetadata file,String userId,List<String> groupIds) throws MRCException {
  try {
    ACLEntry entry=sMan.getACLEntry(1,userId);
    if (entry == null)     entry=sMan.getACLEntry(1,DEFAULT_ENTRY_NAME);
    int rights=entry.getRights() & 3 | ((entry.getRights() & 1) << 2);
    return rights * (1 << 6);
  }
 catch (  Exception exc) {
    throw new MRCException(exc);
  }
}

Fixed version (ground truth):
@Override public int getPosixAccessRights(StorageManager sMan,FileMetadata file,String userId,List<String> groupIds) throws MRCException {
  try {
    ACLEntry entry=sMan.getACLEntry(1,userId);
    if (entry == null)     entry=sMan.getACLEntry(1,DEFAULT_ENTRY_NAME);
    int rights=entry.getRights() & 3 | ((entry.getRights() & 1) << 2);
    rights=rights * (1 << 6);
    return file.isReadOnly() ? rights & READ_ONLY_MASK : rights;
  }
 catch (  Exception exc) {
    throw new MRCException(exc);
  }
}
Program: 113586
Project: 113586
Buggy source:
/** 
 * resynchronizes with the global time obtained from the DIR
 */
private void resync(){
  if (dir == null)   return;
  try {
    long tStart=localSysTime;
    long oldDrift=currentDrift;
    RPCResponse<Long> r=dir.xtreemfs_global_time_get(null);
    Long globalTime=r.get();
    r.freeBuffers();
    long tEnd=System.currentTimeMillis();
    syncRTT=(int)(tEnd - tStart);
    globalTime+=syncRTT / 2;
    syncSuccess=true;
    currentDrift=globalTime - tEnd;
    lastSync=tEnd;
    if (Math.abs(oldDrift - currentDrift) > 5000 && oldDrift != 0) {
      Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,this,"String_Node_Str",oldDrift,currentDrift);
    }
  }
 catch (  Exception ex) {
    syncSuccess=false;
    ex.printStackTrace();
    lastSync=System.currentTimeMillis();
  }
}

Fixed version (ground truth):
/** 
 * resynchronizes with the global time obtained from the DIR
 */
private void resync(){
  if (dir == null)   return;
  RPCResponse<Long> r=null;
  try {
    long tStart=localSysTime;
    long oldDrift=currentDrift;
    r=dir.xtreemfs_global_time_get(null);
    Long globalTime=r.get();
    r.freeBuffers();
    long tEnd=System.currentTimeMillis();
    syncRTT=(int)(tEnd - tStart);
    globalTime+=syncRTT / 2;
    syncSuccess=true;
    currentDrift=globalTime - tEnd;
    lastSync=tEnd;
    if (Math.abs(oldDrift - currentDrift) > 5000 && oldDrift != 0) {
      Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,this,"String_Node_Str",oldDrift,currentDrift);
    }
  }
 catch (  Exception ex) {
    if (r != null) {
      r.freeBuffers();
    }
    syncSuccess=false;
    ex.printStackTrace();
    lastSync=System.currentTimeMillis();
  }
}
Program: 113588
Project: 113588
Buggy source:
public void asyncShutdown(){
  try {
    heartbeatThread.shutdown();
    UUIDResolver.shutdown();
    rpcServer.shutdown();
    rpcClient.shutdown();
    rpcClientForReplication.shutdown();
    udpCom.shutdown();
    preprocStage.shutdown();
    delStage.shutdown();
    stStage.shutdown();
    cThread.cleanupStop();
    httpServ.stop(0);
    if (Logging.isInfo())     Logging.logMessage(Logging.LEVEL_INFO,Category.lifecycle,this,"String_Node_Str");
  }
 catch (  Exception ex) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str");
    Logging.logError(Logging.LEVEL_ERROR,this,ex);
  }
}

Fixed version (ground truth):
public void asyncShutdown(){
  try {
    heartbeatThread.shutdown();
    UUIDResolver.shutdown();
    rpcServer.shutdown();
    rpcClient.shutdown();
    rpcClientForReplication.shutdown();
    udpCom.shutdown();
    preprocStage.shutdown();
    delStage.shutdown();
    stStage.shutdown();
    vStage.shutdown();
    cThread.cleanupStop();
    httpServ.stop(0);
    if (Logging.isInfo())     Logging.logMessage(Logging.LEVEL_INFO,Category.lifecycle,this,"String_Node_Str");
  }
 catch (  Exception ex) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str");
    Logging.logError(Logging.LEVEL_ERROR,this,ex);
  }
}
Program: 113589
Project: 113589
Buggy source:
@Override public void receiveUDP(UDPMessage msg){
  assert(msg.isRequest() || msg.isResponse());
  try {
    if (msg.isRequest()) {
      if (msg.getRequestData() instanceof xtreemfs_broadcast_gmaxRequest) {
        xtreemfs_broadcast_gmaxRequest rq=(xtreemfs_broadcast_gmaxRequest)msg.getRequestData();
        if (Logging.isDebug())         Logging.logMessage(Logging.LEVEL_DEBUG,Category.stage,this,"String_Node_Str",rq.getFile_id(),msg.getAddress());
        BufferPool.free(msg.getPayload());
        stStage.receivedGMAX_ASYNC(rq.getFile_id(),rq.getTruncateEpoch(),rq.getLastObject());
      }
 else       if (msg.getRequestData() instanceof xtreemfs_pingRequest) {
        xtreemfs_pingRequest rq=(xtreemfs_pingRequest)msg.getRequestData();
        if (Logging.isDebug())         Logging.logMessage(Logging.LEVEL_DEBUG,Category.stage,this,"String_Node_Str",msg.getAddress());
      }
    }
 else {
      if (msg.getResponseData() instanceof xtreemfs_pingResponse) {
        xtreemfs_pingResponse resp=(xtreemfs_pingResponse)msg.getResponseData();
        if (Logging.isDebug())         Logging.logMessage(Logging.LEVEL_DEBUG,Category.stage,this,"String_Node_Str",msg.getAddress());
      }
    }
  }
 catch (  Exception ex) {
    Logging.logError(Logging.LEVEL_DEBUG,this,ex);
  }
}

Fixed version (ground truth):
@Override public void receiveUDP(UDPMessage msg){
  assert(msg.isRequest() || msg.isResponse());
  try {
    if (msg.isRequest()) {
      if (msg.getRequestData() instanceof xtreemfs_broadcast_gmaxRequest) {
        xtreemfs_broadcast_gmaxRequest rq=(xtreemfs_broadcast_gmaxRequest)msg.getRequestData();
        if (Logging.isDebug())         Logging.logMessage(Logging.LEVEL_DEBUG,Category.stage,this,"String_Node_Str",rq.getFile_id(),msg.getAddress());
        BufferPool.free(msg.getPayload());
        stStage.receivedGMAX_ASYNC(rq.getFile_id(),rq.getTruncateEpoch(),rq.getLastObject());
      }
 else       if (msg.getRequestData() instanceof xtreemfs_pingRequest) {
        xtreemfs_pingRequest rq=(xtreemfs_pingRequest)msg.getRequestData();
        if (Logging.isDebug())         Logging.logMessage(Logging.LEVEL_DEBUG,Category.stage,this,"String_Node_Str",msg.getAddress());
        vStage.receiveVivaldiMessage(msg);
      }
    }
 else {
      if (msg.getResponseData() instanceof xtreemfs_pingResponse) {
        xtreemfs_pingResponse resp=(xtreemfs_pingResponse)msg.getResponseData();
        if (Logging.isDebug())         Logging.logMessage(Logging.LEVEL_DEBUG,Category.stage,this,"String_Node_Str",msg.getAddress());
        vStage.receiveVivaldiMessage(msg);
      }
    }
  }
 catch (  Exception ex) {
    Logging.logError(Logging.LEVEL_DEBUG,this,ex);
  }
}
Program: 113590
Project: 113590
Buggy source:
public void start(){
  try {
    rpcServer.start();
    rpcClient.start();
    rpcClientForReplication.start();
    rpcServer.waitForStartup();
    rpcClient.waitForStartup();
    udpCom.start();
    preprocStage.start();
    delStage.start();
    stStage.start();
    replStage.start();
    cThread.start();
    udpCom.waitForStartup();
    preprocStage.waitForStartup();
    delStage.waitForStartup();
    stStage.waitForStartup();
    cThread.waitForStartup();
    heartbeatThread.initialize();
    heartbeatThread.start();
    heartbeatThread.waitForStartup();
    if (Logging.isInfo())     Logging.logMessage(Logging.LEVEL_INFO,Category.lifecycle,this,"String_Node_Str");
  }
 catch (  Exception ex) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str");
    Logging.logError(Logging.LEVEL_ERROR,this,ex);
    System.exit(1);
  }
}

Fixed version (ground truth):
public void start(){
  try {
    rpcServer.start();
    rpcClient.start();
    rpcClientForReplication.start();
    rpcServer.waitForStartup();
    rpcClient.waitForStartup();
    udpCom.start();
    preprocStage.start();
    delStage.start();
    stStage.start();
    replStage.start();
    vStage.start();
    cThread.start();
    udpCom.waitForStartup();
    preprocStage.waitForStartup();
    delStage.waitForStartup();
    stStage.waitForStartup();
    vStage.waitForStartup();
    cThread.waitForStartup();
    heartbeatThread.initialize();
    heartbeatThread.start();
    heartbeatThread.waitForStartup();
    if (Logging.isInfo())     Logging.logMessage(Logging.LEVEL_INFO,Category.lifecycle,this,"String_Node_Str");
  }
 catch (  Exception ex) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str");
    Logging.logError(Logging.LEVEL_ERROR,this,ex);
    System.exit(1);
  }
}
Program: 113591
Project: 113591
Buggy source:
public VivaldiStage getVivaldiStage(){
  return null;
}

Fixed version (ground truth):
public VivaldiStage getVivaldiStage(){
  return this.vStage;
}
Program: 113592
Project: 113592
Buggy source:
public void shutdown(){
  try {
    heartbeatThread.shutdown();
    heartbeatThread.waitForShutdown();
    UUIDResolver.shutdown();
    rpcServer.shutdown();
    rpcClient.shutdown();
    rpcClientForReplication.shutdown();
    rpcServer.waitForShutdown();
    rpcClient.waitForShutdown();
    rpcClientForReplication.waitForShutdown();
    serviceAvailability.shutdown();
    udpCom.shutdown();
    preprocStage.shutdown();
    delStage.shutdown();
    stStage.shutdown();
    replStage.shutdown();
    cThread.shutdown();
    udpCom.waitForShutdown();
    preprocStage.waitForShutdown();
    delStage.waitForShutdown();
    stStage.waitForShutdown();
    replStage.waitForShutdown();
    cThread.waitForShutdown();
    httpServ.stop(0);
    if (Logging.isInfo())     Logging.logMessage(Logging.LEVEL_INFO,Category.lifecycle,this,"String_Node_Str");
  }
 catch (  Exception ex) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str");
    Logging.logError(Logging.LEVEL_ERROR,this,ex);
  }
}

Fixed version (ground truth):
public void shutdown(){
  try {
    heartbeatThread.shutdown();
    heartbeatThread.waitForShutdown();
    UUIDResolver.shutdown();
    rpcServer.shutdown();
    rpcClient.shutdown();
    rpcClientForReplication.shutdown();
    rpcServer.waitForShutdown();
    rpcClient.waitForShutdown();
    rpcClientForReplication.waitForShutdown();
    serviceAvailability.shutdown();
    udpCom.shutdown();
    preprocStage.shutdown();
    delStage.shutdown();
    stStage.shutdown();
    replStage.shutdown();
    vStage.shutdown();
    cThread.shutdown();
    udpCom.waitForShutdown();
    preprocStage.waitForShutdown();
    delStage.waitForShutdown();
    stStage.waitForShutdown();
    replStage.waitForShutdown();
    vStage.waitForShutdown();
    cThread.waitForShutdown();
    httpServ.stop(0);
    if (Logging.isInfo())     Logging.logMessage(Logging.LEVEL_INFO,Category.lifecycle,this,"String_Node_Str");
  }
 catch (  Exception ex) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str");
    Logging.logError(Logging.LEVEL_ERROR,this,ex);
  }
}
Program: 113593
Project: 113593
Buggy source:
/** 
 * Updates the list of known OSDs, from the data stored in the DS. This function is responsible of keeping a list of OSDs used by the algorithm.
 */
private void updateKnownOSDs(){
  RPCResponse<ServiceSet> r=null;
  try {
    r=dirClient.xtreemfs_service_get_by_type(null,ServiceType.SERVICE_TYPE_OSD);
    knownOSDs=r.get();
    String ownUUID=master.getConfig().getUUID().toString();
    ServiceSet newOSDs=new ServiceSet();
    for (    Service osd : knownOSDs) {
      if (!ownUUID.equals(osd.getUuid()) && osd.getLast_updated_s() != 0) {
        newOSDs.add(osd);
      }
    }
    knownOSDs=newOSDs;
    if (Logging.isInfo())     Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + knownOSDs.size() + "String_Node_Str");
  }
 catch (  Exception exc) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str" + exc);
  }
 finally {
    if (r != null) {
      r.freeBuffers();
    }
    sentRequests.clear();
    sentRetries.clear();
  }
}

Fixed version (ground truth):
/** 
 * Updates the list of known OSDs, from the data stored in the DS. This function is responsible of keeping a list of OSDs used by the algorithm.
 */
private void updateKnownOSDs(){
  RPCResponse<ServiceSet> r=null;
  try {
    r=dirClient.xtreemfs_service_get_by_type(null,ServiceType.SERVICE_TYPE_OSD);
    knownOSDs=r.get();
    String ownUUID=master.getConfig().getUUID().toString();
    ServiceSet newOSDs=new ServiceSet();
    for (    Service osd : knownOSDs) {
      if (!ownUUID.equals(osd.getUuid()) && osd.getLast_updated_s() != 0) {
        newOSDs.add(osd);
      }
    }
    knownOSDs=newOSDs;
    if (Logging.isInfo())     Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + knownOSDs.size() + "String_Node_Str");
  }
 catch (  Exception exc) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str" + exc);
    knownOSDs=new ServiceSet();
  }
 finally {
    if (r != null) {
      r.freeBuffers();
    }
    sentRequests.clear();
    sentRetries.clear();
  }
}
Program: 113594
Project: 113594
Buggy source:
@Override public int getPosixAccessRights(StorageManager sMan,FileMetadata file,String userId,List<String> groupIds) throws MRCException {
  return file.isReadOnly() ? file.getPerms() & READ_ONLY_MASK : file.getPerms();
}

Fixed version (ground truth):
@Override public int getPosixAccessRights(StorageManager sMan,FileMetadata file,String userId,List<String> groupIds) throws MRCException {
  return !file.isDirectory() && file.isReadOnly() ? file.getPerms() & READ_ONLY_MASK : file.getPerms();
}
Program: 113595
Project: 113595
Buggy source:
/** 
 * Updates the list of known OSDs, from the data stored in the DS. This function is responsible of keeping a list of OSDs used by the algorithm.
 */
private void updateKnownOSDs(){
  RPCResponse<ServiceSet> r=null;
  try {
    r=dirClient.xtreemfs_service_get_by_type(null,ServiceType.SERVICE_TYPE_OSD);
    knownOSDs=r.get();
    String ownUUID=master.getConfig().getUUID().toString();
    ServiceSet newOSDs=new ServiceSet();
    for (    Service osd : knownOSDs) {
      if (!ownUUID.equals(osd.getUuid()) && osd.getLast_updated_s() != 0) {
        newOSDs.add(osd);
      }
    }
    knownOSDs=newOSDs;
    if (Logging.isInfo())     Logging.logMessage(Logging.LEVEL_INFO,Category.lifecycle,this,"String_Node_Str");
  }
 catch (  Exception exc) {
    Logging.logError(Logging.LEVEL_ERROR,this,exc);
    this.notifyCrashed(exc);
  }
 finally {
    if (r != null) {
      r.freeBuffers();
    }
    sentRequests.clear();
    sentRetries.clear();
  }
}

Fixed version (ground truth):
/** 
 * Updates the list of known OSDs, from the data stored in the DS. This function is responsible of keeping a list of OSDs used by the algorithm.
 */
private void updateKnownOSDs(){
  RPCResponse<ServiceSet> r=null;
  try {
    r=dirClient.xtreemfs_service_get_by_type(null,ServiceType.SERVICE_TYPE_OSD);
    knownOSDs=r.get();
    String ownUUID=master.getConfig().getUUID().toString();
    ServiceSet newOSDs=new ServiceSet();
    for (    Service osd : knownOSDs) {
      if (!ownUUID.equals(osd.getUuid()) && osd.getLast_updated_s() != 0) {
        newOSDs.add(osd);
      }
    }
    knownOSDs=newOSDs;
    if (Logging.isInfo())     Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str");
  }
 catch (  Exception exc) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str" + exc);
  }
 finally {
    if (r != null) {
      r.freeBuffers();
    }
    sentRequests.clear();
    sentRetries.clear();
  }
}
Program: 113602
Project: 113602
Buggy source:
@Override public Lock getResult(ReusableBuffer data){
  xtreemfs_lock_releaseResponse resp=new xtreemfs_lock_releaseResponse();
  resp.unmarshal(new XDRUnmarshaller(data));
  return null;
}

Fixed version (ground truth):
@Override public VivaldiCoordinates getResult(ReusableBuffer data){
  xtreemfs_pingResponse resp=new xtreemfs_pingResponse();
  resp.unmarshal(new XDRUnmarshaller(data));
  return resp.getRemote_coordinates();
}
Program: 113603
Project: 113603
Buggy source:
@Override protected void processMethod(StageRequest method){
  if (method.getStageMethod() == STAGEOP_COORD_XCHG_REQUEST) {
    UDPMessage msg=(UDPMessage)method.getArgs()[0];
    final ReusableBuffer data=msg.getPayload();
    data.position(1);
    VivaldiCoordinates vc=new VivaldiCoordinates();
    vc.unmarshal(new XDRUnmarshaller(data));
    BufferPool.free(data);
    if (msg.isRequest()) {
      sendVivaldiCoordinates(msg,vc);
    }
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override protected void processMethod(StageRequest method){
  if (method.getStageMethod() == STAGEOP_COORD_XCHG_REQUEST) {
    UDPMessage msg=(UDPMessage)method.getArgs()[0];
    xtreemfs_pingRequest prq=(xtreemfs_pingRequest)msg.getRequestData();
    if (msg.isRequest()) {
      System.out.println("String_Node_Str" + prq.getCoordinates().getX_coordinate() + "String_Node_Str"+ prq.getCoordinates().getY_coordinate());
      sendVivaldiCoordinates(msg,prq.getCoordinates());
    }
  }
 else   if (method.getStageMethod() == STAGEOP_TCP_VIVALID_PING) {
    VivaldiPingCallback cb=(VivaldiPingCallback)method.getCallback();
    VivaldiCoordinates remoteCoordinates=(VivaldiCoordinates)method.getArgs()[0];
    cb.coordinatesCallback(remoteCoordinates,null);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 113604
Project: 113604
Buggy source:
@Test public void testVivaldiPing() throws Exception {
  xtreemfs_pingRequest payload=new xtreemfs_pingRequest(new VivaldiCoordinates());
  ONCRPCRequestHeader rq=new ONCRPCRequestHeader(1,1,1,payload.getTag());
  final int fragHdr=ONCRPCRecordFragmentHeader.getFragmentHeader(rq.getXDRSize(),true);
  ONCRPCBufferWriter wr=new ONCRPCBufferWriter(ONCRPCBufferWriter.BUFF_SIZE);
  wr.writeInt32(null,fragHdr);
  rq.marshal(wr);
  payload.marshal(wr);
  wr.flip();
  DatagramSocket dsock=new DatagramSocket();
  byte[] data=wr.getBuffers().get(0).array();
  DatagramPacket dpack=new DatagramPacket(data,data.length,env.getOSDAddress());
  dsock.send(dpack);
  DatagramPacket answer=new DatagramPacket(new byte[1024],1024);
  dsock.setSoTimeout(250);
  dsock.receive(answer);
  ReusableBuffer rb=ReusableBuffer.wrap(answer.getData());
  rb.position(Integer.SIZE / 8);
  ONCRPCResponseHeader rhdr=new ONCRPCResponseHeader();
  rhdr.unmarshal(new XDRUnmarshaller(rb));
  xtreemfs_pingResponse resp=new xtreemfs_pingResponse();
  resp.unmarshal(new XDRUnmarshaller(rb));
  dsock.close();
}

Fixed version (ground truth):
@Test public void testVivaldiPing() throws Exception {
  xtreemfs_pingRequest payload=new xtreemfs_pingRequest(new VivaldiCoordinates(1.1,1.2,0.5));
  ONCRPCRequestHeader rq=new ONCRPCRequestHeader(1,1,1,payload.getTag());
  final int fragHdr=ONCRPCRecordFragmentHeader.getFragmentHeader(rq.getXDRSize(),true);
  ONCRPCBufferWriter wr=new ONCRPCBufferWriter(ONCRPCBufferWriter.BUFF_SIZE);
  wr.writeInt32(null,fragHdr);
  rq.marshal(wr);
  payload.marshal(wr);
  wr.flip();
  DatagramSocket dsock=new DatagramSocket();
  byte[] data=wr.getBuffers().get(0).array();
  DatagramPacket dpack=new DatagramPacket(data,data.length,env.getOSDAddress());
  dsock.send(dpack);
  DatagramPacket answer=new DatagramPacket(new byte[1024],1024);
  dsock.setSoTimeout(250);
  dsock.receive(answer);
  ReusableBuffer rb=ReusableBuffer.wrap(answer.getData());
  rb.position(Integer.SIZE / 8);
  ONCRPCResponseHeader rhdr=new ONCRPCResponseHeader();
  rhdr.unmarshal(new XDRUnmarshaller(rb));
  xtreemfs_pingResponse resp=new xtreemfs_pingResponse();
  resp.unmarshal(new XDRUnmarshaller(rb));
  dsock.close();
}
Program: 113605
Project: 113605
Buggy source:
@Before public void setUp() throws Exception {
  env=new TestEnvironment(new TestEnvironment.Services[]{Services.DIR_SERVICE,Services.OSD});
  env.start();
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  env=new TestEnvironment(new TestEnvironment.Services[]{Services.DIR_SERVICE,Services.OSD,Services.OSD_CLIENT});
  env.start();
}
Program: 113607
Project: 113607
Buggy source:
private boolean hasTimedOut(Service osd){
  long updateTimestamp=osd.getLast_updated_s();
  long currentTime=TimeSync.getGlobalTime() / 1000;
  return currentTime - updateTimestamp > maxOfflineTime;
}

Fixed version (ground truth):
private boolean hasTimedOut(Service osd){
  long lastUpdate=Long.parseLong(osd.getData().get("String_Node_Str"));
  return lastUpdate > maxOfflineTime;
}
Program: 113608
Project: 113608
Buggy source:
public static Replica createReplica(StripingPolicy stripingPolicy,StorageManager sMan,OSDStatusManager osdMan,VolumeInfo volume,long parentDirId,String path,InetAddress clientAddress,XLocList currentXLoc,int replFlags) throws DatabaseException, UserException, MRCException {
  if (stripingPolicy == null)   stripingPolicy=sMan.getDefaultStripingPolicy(parentDirId);
  if (stripingPolicy == null)   stripingPolicy=sMan.getDefaultStripingPolicy(1);
  if (stripingPolicy == null)   throw new UserException(ErrNo.EIO,"String_Node_Str" + path + "String_Node_Str");
  org.xtreemfs.interfaces.StripingPolicy sp=new org.xtreemfs.interfaces.StripingPolicy(StripingPolicyType.valueOf(stripingPolicy.getPattern()),stripingPolicy.getStripeSize(),stripingPolicy.getWidth());
  StringSet osds=new StringSet();
  ServiceSet usableOSDs=osdMan.getUsableOSDs(volume.getId(),clientAddress,currentXLoc,stripingPolicy.getStripeSize());
  if (usableOSDs == null || usableOSDs.size() == 0)   throw new UserException(ErrNo.EIO,"String_Node_Str" + path + "String_Node_Str");
  int width=Math.min((int)stripingPolicy.getWidth(),usableOSDs.size());
  stripingPolicy=sMan.createStripingPolicy(stripingPolicy.getPattern(),stripingPolicy.getStripeSize(),width);
  sp.setWidth(width);
  for (int i=0; i < width; i++)   osds.add(usableOSDs.get(i).getUuid());
  return new Replica(sp,replFlags,osds);
}

Fixed version (ground truth):
public static Replica createReplica(StripingPolicy stripingPolicy,StorageManager sMan,OSDStatusManager osdMan,VolumeInfo volume,long parentDirId,String path,InetAddress clientAddress,XLocList currentXLoc,int replFlags) throws DatabaseException, UserException, MRCException {
  if (stripingPolicy == null)   stripingPolicy=sMan.getDefaultStripingPolicy(parentDirId);
  if (stripingPolicy == null)   stripingPolicy=sMan.getDefaultStripingPolicy(1);
  if (stripingPolicy == null)   throw new UserException(ErrNo.EIO,"String_Node_Str" + path + "String_Node_Str");
  org.xtreemfs.interfaces.StripingPolicy sp=new org.xtreemfs.interfaces.StripingPolicy(StripingPolicyType.valueOf(stripingPolicy.getPattern()),stripingPolicy.getStripeSize(),stripingPolicy.getWidth());
  StringSet osds=new StringSet();
  ServiceSet usableOSDs=osdMan.getUsableOSDs(volume.getId(),clientAddress,currentXLoc,stripingPolicy.getStripeSize());
  if (usableOSDs == null || usableOSDs.size() == 0) {
    Logging.logMessage(Logging.LEVEL_WARN,Category.all,(Object)null,"String_Node_Str",path);
    throw new UserException(ErrNo.EIO,"String_Node_Str" + path + "String_Node_Str");
  }
  int width=Math.min((int)stripingPolicy.getWidth(),usableOSDs.size());
  sp.setWidth(width);
  for (int i=0; i < width; i++)   osds.add(usableOSDs.get(i).getUuid());
  return new Replica(sp,replFlags,osds);
}
Program: 113609
Project: 113609
Buggy source:
public int compare(Service o1,Service o2){
  try {
    final String host1=new ServiceUUID(o1.getUuid()).getAddress().getAddress().getCanonicalHostName();
    final String host2=new ServiceUUID(o2.getUuid()).getAddress().getAddress().getCanonicalHostName();
    return host1.compareTo(host2);
  }
 catch (  UnknownUUIDException exc) {
    Logging.logError(Logging.LEVEL_ERROR,this,exc);
    return 0;
  }
}

Fixed version (ground truth):
public int compare(Service o1,Service o2){
  try {
    final String host1=new ServiceUUID(o1.getUuid()).getAddress().getHostName();
    final String host2=new ServiceUUID(o2.getUuid()).getAddress().getHostName();
    return getMatch(host2,clientIP.getHostName()) - getMatch(host1,clientIP.getHostName());
  }
 catch (  UnknownUUIDException exc) {
    Logging.logError(Logging.LEVEL_ERROR,this,exc);
    return 0;
  }
}
Program: 113610
Project: 113610
Buggy source:
@Override public ServiceSet getOSDs(ServiceSet allOSDs){
  Collections.sort(allOSDs,new Comparator<Service>(){
    public int compare(    Service o1,    Service o2){
      try {
        final String host1=new ServiceUUID(o1.getUuid()).getAddress().getAddress().getCanonicalHostName();
        final String host2=new ServiceUUID(o2.getUuid()).getAddress().getAddress().getCanonicalHostName();
        return host1.compareTo(host2);
      }
 catch (      UnknownUUIDException exc) {
        Logging.logError(Logging.LEVEL_ERROR,this,exc);
        return 0;
      }
    }
  }
);
  return allOSDs;
}

Fixed version (ground truth):
@Override public ServiceSet getOSDs(ServiceSet allOSDs){
  return allOSDs;
}
Program: 113611
Project: 113611
Buggy source:
public int compare(Service o1,Service o2){
  try {
    return getMatch(new ServiceUUID(o1.getUuid()).getAddress().getHostName(),clientIP.getCanonicalHostName()) - getMatch(new ServiceUUID(o2.getUuid()).getAddress().getHostName(),clientIP.getCanonicalHostName());
  }
 catch (  UnknownUUIDException e) {
    Logging.logMessage(Logging.LEVEL_WARN,Category.misc,this,"String_Node_Str");
    Logging.logMessage(Logging.LEVEL_WARN,this,OutputUtils.stackTraceToString(e));
    return 0;
  }
}

Fixed version (ground truth):
public int compare(Service o1,Service o2){
  try {
    return getMatch(new ServiceUUID(o2.getUuid()).getAddress().getHostName(),clientIP.getCanonicalHostName()) - getMatch(new ServiceUUID(o1.getUuid()).getAddress().getHostName(),clientIP.getCanonicalHostName());
  }
 catch (  UnknownUUIDException e) {
    Logging.logMessage(Logging.LEVEL_WARN,Category.misc,this,"String_Node_Str");
    Logging.logMessage(Logging.LEVEL_WARN,this,OutputUtils.stackTraceToString(e));
    return 0;
  }
}
Program: 113612
Project: 113612
Buggy source:
private ReusableBuffer checkAndGetBuffer(int requiredSpace){
  final ReusableBuffer currentBuf=buffers.get(currentBuffer);
  if (currentBuf.remaining() >= requiredSpace) {
    return currentBuf;
  }
 else {
    currentBuffer++;
    final ReusableBuffer buf=BufferPool.allocate(bufSize);
    buffers.add(buf);
    return buf;
  }
}

Fixed version (ground truth):
private ReusableBuffer checkAndGetBuffer(int requiredSpace){
  final ReusableBuffer currentBuf=buffers.get(currentBuffer);
  if (currentBuf.remaining() >= requiredSpace) {
    return currentBuf;
  }
 else {
    currentBuffer++;
    final int newBufSize=(bufSize >= requiredSpace) ? bufSize : requiredSpace;
    final ReusableBuffer buf=BufferPool.allocate(newBufSize);
    buffers.add(buf);
    return buf;
  }
}
Program: 113613
Project: 113613
Buggy source:
/** 
 * sends an error to all belonging clients (for all objects of the file)
 */
public void reportError(Exception error){
  Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,error.getMessage());
  for (  ReplicatingObject object : waitingRequests.values()) {
    object.sendError(error);
  }
  for (  ReplicatingObject object : objectsInProgress.values()) {
    object.sendError(error);
  }
}

Fixed version (ground truth):
/** 
 * sends an error to all belonging clients (for all objects of the file)
 */
public void reportError(Exception error){
  Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,"String_Node_Str",error.getMessage());
  for (  ReplicatingObject object : waitingRequests.values()) {
    object.sendError(error);
  }
  for (  ReplicatingObject object : objectsInProgress.values()) {
    object.sendError(error);
  }
}
Program: 113615
Project: 113615
Buggy source:
public static Replica createReplica(StripingPolicy stripingPolicy,StorageManager sMan,OSDStatusManager osdMan,PolicyContainer policyContainer,VolumeInfo volume,long parentDirId,String path,InetAddress clientAddress) throws DatabaseException, UserException, MRCException {
  if (stripingPolicy == null)   stripingPolicy=sMan.getDefaultStripingPolicy(parentDirId);
  if (stripingPolicy == null)   stripingPolicy=sMan.getDefaultStripingPolicy(1);
  if (stripingPolicy == null)   throw new UserException(ErrNo.EIO,"String_Node_Str" + path + "String_Node_Str");
  org.xtreemfs.interfaces.StripingPolicy sp=new org.xtreemfs.interfaces.StripingPolicy(StripingPolicyType.valueOf(stripingPolicy.getPattern()),stripingPolicy.getStripeSize(),stripingPolicy.getWidth());
  StringSet osds=new StringSet();
  ServiceSet osdMaps=osdMan.getUsableOSDs(volume.getId());
  if (osdMaps == null || osdMaps.size() == 0)   throw new UserException(ErrNo.EIO,"String_Node_Str" + path + "String_Node_Str");
  int width=Math.min((int)stripingPolicy.getWidth(),osdMaps.size());
  stripingPolicy=sMan.createStripingPolicy(stripingPolicy.getPattern(),stripingPolicy.getStripeSize(),width);
  try {
    for (    String osd : policyContainer.getOSDSelectionPolicy(volume.getOsdPolicyId()).getOSDsForNewFile(osdMaps,clientAddress,width,volume.getOsdPolicyArgs()))     osds.add(osd);
  }
 catch (  MRCException exc) {
    throw exc;
  }
catch (  Exception exc) {
    throw new MRCException(exc);
  }
  return new Replica(sp,0,osds);
}

Fixed version (ground truth):
public static Replica createReplica(StripingPolicy stripingPolicy,StorageManager sMan,OSDStatusManager osdMan,PolicyContainer policyContainer,VolumeInfo volume,long parentDirId,String path,InetAddress clientAddress) throws DatabaseException, UserException, MRCException {
  if (stripingPolicy == null)   stripingPolicy=sMan.getDefaultStripingPolicy(parentDirId);
  if (stripingPolicy == null)   stripingPolicy=sMan.getDefaultStripingPolicy(1);
  if (stripingPolicy == null)   throw new UserException(ErrNo.EIO,"String_Node_Str" + path + "String_Node_Str");
  org.xtreemfs.interfaces.StripingPolicy sp=new org.xtreemfs.interfaces.StripingPolicy(StripingPolicyType.valueOf(stripingPolicy.getPattern()),stripingPolicy.getStripeSize(),stripingPolicy.getWidth());
  StringSet osds=new StringSet();
  ServiceSet osdMaps=osdMan.getUsableOSDs(volume.getId());
  if (osdMaps == null || osdMaps.size() == 0)   throw new UserException(ErrNo.EIO,"String_Node_Str" + path + "String_Node_Str");
  int width=Math.min((int)stripingPolicy.getWidth(),osdMaps.size());
  stripingPolicy=sMan.createStripingPolicy(stripingPolicy.getPattern(),stripingPolicy.getStripeSize(),width);
  sp.setWidth(width);
  try {
    for (    String osd : policyContainer.getOSDSelectionPolicy(volume.getOsdPolicyId()).getOSDsForNewFile(osdMaps,clientAddress,width,volume.getOsdPolicyArgs()))     osds.add(osd);
  }
 catch (  MRCException exc) {
    throw exc;
  }
catch (  Exception exc) {
    throw new MRCException(exc);
  }
  return new Replica(sp,0,osds);
}
Program: 113618
Project: 113618
Buggy source:
public String getStatus(){
synchronized (this) {
    if (isRunning) {
      Date d=new Date(startTime);
      return String.format(STATUS_FORMAT,filesChecked,zombies.get(),DateFormat.getDateInstance().format(d));
    }
 else {
      Date d=new Date(startTime);
      return String.format(STOPPED_FORMAT,DateFormat.getDateInstance().format(d));
    }
  }
}

Fixed version (ground truth):
public String getStatus(){
synchronized (this) {
    String d=DateFormat.getDateInstance().format(new Date(startTime));
    assert(d != null);
    if (isRunning) {
      return String.format(STATUS_FORMAT,filesChecked,zombies.get(),d);
    }
 else {
      return String.format(STOPPED_FORMAT,d);
    }
  }
}
Program: 113619
Project: 113619
Buggy source:
public CleanupThread(OSDRequestDispatcher master,HashStorageLayout layout){
  super("String_Node_Str");
  this.zombies=new AtomicLong(0L);
  this.master=master;
  this.isRunning=false;
  this.quit=false;
  this.layout=layout;
  this.results=new StringSet();
  localUUID=master.getConfig().getUUID();
}

Fixed version (ground truth):
public CleanupThread(OSDRequestDispatcher master,HashStorageLayout layout){
  super("String_Node_Str");
  this.zombies=new AtomicLong(0L);
  this.master=master;
  this.isRunning=false;
  this.quit=false;
  this.layout=layout;
  this.results=new StringSet();
  this.localUUID=master.getConfig().getUUID();
  this.startTime=0L;
  this.filesChecked=0L;
}
Program: 113620
Project: 113620
Buggy source:
/** 
 * Performs a cleanUp-Operation.<br> Checks the status for errors.
 * @param restore
 * @param deleteVolumes
 * @param killZombies
 * @return the result of the cleanup operation.
 * @throws InterruptedException
 * @throws ONCRPCException
 * @throws IOException
 */
private StringSet makeCleanup(boolean restore,boolean deleteVolumes,boolean killZombies) throws InterruptedException, ONCRPCException, IOException {
  RPCResponse<?> r=null;
  r=env.getOSDClient().internal_cleanup_start(env.getOSDAddress(),killZombies,deleteVolumes,restore,"String_Node_Str");
  r.get();
  r.freeBuffers();
  boolean isRunning=true;
  do {
    r=env.getOSDClient().internal_cleanup_status(env.getOSDAddress(),"String_Node_Str");
    String stat=(String)r.get();
    r.freeBuffers();
    r=env.getOSDClient().internal_cleanup_is_running(env.getOSDAddress(),"String_Node_Str");
    isRunning=(Boolean)r.get();
    r.freeBuffers();
    if (isRunning) {
      assertNotNull(stat);
      assertTrue(stat.matches(CleanupThread.getRegex(CleanupThread.STATUS_FORMAT)));
      Thread.sleep(250);
    }
 else {
      assertNotNull(stat);
      assertTrue(stat.matches(CleanupThread.getRegex(CleanupThread.STOPPED_FORMAT)));
    }
  }
 while (isRunning);
  r=env.getOSDClient().internal_cleanup_get_result(env.getOSDAddress(),"String_Node_Str");
  StringSet results=(StringSet)r.get();
  r.freeBuffers();
  return results;
}

Fixed version (ground truth):
/** 
 * Performs a cleanUp-Operation.<br> Checks the status for errors.
 * @param restore
 * @param deleteVolumes
 * @param killZombies
 * @return the result of the cleanup operation.
 * @throws InterruptedException
 * @throws ONCRPCException
 * @throws IOException
 */
private StringSet makeCleanup(boolean restore,boolean deleteVolumes,boolean killZombies) throws InterruptedException, ONCRPCException, IOException {
  String statF=CleanupThread.getRegex(CleanupThread.STATUS_FORMAT);
  String stopF=CleanupThread.getRegex(CleanupThread.STOPPED_FORMAT);
  assertNotNull(statF);
  assertNotNull(stopF);
  RPCResponse<?> r=null;
  r=env.getOSDClient().internal_cleanup_start(env.getOSDAddress(),killZombies,deleteVolumes,restore,"String_Node_Str");
  r.get();
  r.freeBuffers();
  boolean isRunning=true;
  do {
    r=env.getOSDClient().internal_cleanup_status(env.getOSDAddress(),"String_Node_Str");
    String stat=(String)r.get();
    r.freeBuffers();
    assertNotNull(stat);
    try {
      if (stat.matches(statF))       assertTrue(true);
    }
 catch (    NullPointerException ne) {
      assertTrue(stat.matches(stopF));
    }
    r=env.getOSDClient().internal_cleanup_is_running(env.getOSDAddress(),"String_Node_Str");
    isRunning=(Boolean)r.get();
    r.freeBuffers();
  }
 while (isRunning);
  r=env.getOSDClient().internal_cleanup_get_result(env.getOSDAddress(),"String_Node_Str");
  StringSet results=(StringSet)r.get();
  r.freeBuffers();
  return results;
}
Program: 113622
Project: 113622
Buggy source:
@Override public void startRequest(final OSDRequest rq){
  final xtreemfs_internal_get_file_sizeRequest args=(xtreemfs_internal_get_file_sizeRequest)rq.getRequestArgs();
  System.out.println("String_Node_Str" + args);
  final StripingPolicyImpl sp=rq.getLocationList().getLocalReplica().getStripingPolicy();
  master.getStorageStage().getFilesize(args.getFile_id(),sp,rq,new GetFileSizeCallback(){
    @Override public void getFileSizeComplete(    long fileSize,    Exception error){
      step2(rq,args,fileSize,error);
    }
  }
);
}

Fixed version (ground truth):
@Override public void startRequest(final OSDRequest rq){
  final xtreemfs_internal_get_file_sizeRequest args=(xtreemfs_internal_get_file_sizeRequest)rq.getRequestArgs();
  final StripingPolicyImpl sp=rq.getLocationList().getLocalReplica().getStripingPolicy();
  master.getStorageStage().getFilesize(args.getFile_id(),sp,rq,new GetFileSizeCallback(){
    @Override public void getFileSizeComplete(    long fileSize,    Exception error){
      step2(rq,args,fileSize,error);
    }
  }
);
}
Program: 113623
Project: 113623
Buggy source:
public void update(Capability cap,XLocations xLoc,CowPolicy cow){
  this.cap=cap;
  this.cow=cow;
  if (xLoc.getXLocSet().getVersion() > this.xLoc.getXLocSet().getVersion()) {
    this.xLoc=xLoc;
    this.strategy.updateXLoc(xLoc);
  }
}

Fixed version (ground truth):
public void update(Capability cap,XLocations xLoc,CowPolicy cow){
  this.cow=cow;
  if (cap.getExpires() > this.cap.getExpires() || cap.getEpochNo() > this.cap.getEpochNo()) {
    this.cap=cap;
  }
  if (xLoc.getXLocSet().getVersion() > this.xLoc.getXLocSet().getVersion()) {
    this.xLoc=xLoc;
    this.strategy.updateXLoc(xLoc);
  }
}
Program: 113624
Project: 113624
Buggy source:
public ObjectInfo(){
  this.waitingRequests=new ArrayList<StageRequest>();
}

Fixed version (ground truth):
public ObjectInfo(){
  this.waitingRequests=new ArrayList<StageRequest>(2);
}
Program: 113625
Project: 113625
Buggy source:
/** 
 * Prepares the request by using the associated TransferStrategy.
 */
private void prepareRequest(FileInfo fileInfo,long objectNo){
  TransferStrategy strategy=fileInfo.strategy;
  strategy.selectNextOSD(objectNo);
  NextRequest next=strategy.getNext();
  if (next != null) {
    Logging.logMessage(Logging.LEVEL_DEBUG,Category.replication,this,"String_Node_Str",fileInfo.fileID,next.objectNo,next.osd);
    fileInfo.get(objectNo).lastOSD=next.osd;
    sendFetchObjectRequest(next.objectNo,next.osd,fileInfo.fileID,fileInfo.cap,fileInfo.xLoc);
  }
 else {
    sendError(fileInfo,objectNo,new OSDException(ErrorCodes.IO_ERROR,"String_Node_Str","String_Node_Str"));
    Logging.logMessage(Logging.LEVEL_DEBUG,Category.replication,this,"String_Node_Str",fileInfo.fileID,next.objectNo);
    System.out.println("String_Node_Str" + objectNo + "String_Node_Str"+ fileInfo.fileID+ "String_Node_Str");
    System.out.println("String_Node_Str" + fileInfo.lastObject);
    System.out.println("String_Node_Str" + fileInfo.cap.toString());
    System.out.println("String_Node_Str" + fileInfo.xLoc.getReplicas().toString());
    System.out.println("String_Node_Str" + fileInfo.get(objectNo).lastOSD);
    System.out.println("String_Node_Str" + fileInfo.get(objectNo).waitingRequests.size());
    System.out.println("String_Node_Str" + fileInfo.strategy.getObjectsCount());
    System.out.println("String_Node_Str" + fileInfo.strategy.isHole(objectNo));
    objectCompleted(fileInfo,objectNo);
  }
}

Fixed version (ground truth):
/** 
 * Prepares the request by using the associated TransferStrategy.
 */
private void prepareRequest(FileInfo fileInfo,long objectNo){
  TransferStrategy strategy=fileInfo.strategy;
  strategy.selectNextOSD(objectNo);
  NextRequest next=strategy.getNext();
  if (next != null) {
    Logging.logMessage(Logging.LEVEL_DEBUG,Category.replication,this,"String_Node_Str",fileInfo.fileID,next.objectNo,next.osd);
    fileInfo.get(objectNo).lastOSD=next.osd;
    sendFetchObjectRequest(next.objectNo,next.osd,fileInfo.fileID,fileInfo.cap,fileInfo.xLoc);
  }
 else {
    sendError(fileInfo,objectNo,new OSDException(ErrorCodes.IO_ERROR,"String_Node_Str","String_Node_Str"));
    Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,"String_Node_Str",fileInfo.fileID,objectNo);
    System.out.println("String_Node_Str" + objectNo + "String_Node_Str"+ fileInfo.fileID+ "String_Node_Str");
    System.out.println("String_Node_Str" + fileInfo.lastObject);
    System.out.println("String_Node_Str" + fileInfo.cap.toString());
    System.out.println("String_Node_Str" + fileInfo.xLoc.getReplicas().toString());
    System.out.println("String_Node_Str" + fileInfo.get(objectNo).lastOSD);
    System.out.println("String_Node_Str" + fileInfo.get(objectNo).waitingRequests.size());
    System.out.println("String_Node_Str" + fileInfo.strategy.getObjectsCount());
    System.out.println("String_Node_Str" + fileInfo.strategy.isHole(objectNo));
    objectCompleted(fileInfo,objectNo);
  }
}
Program: 113626
Project: 113626
Buggy source:
public RPCResponse<VolumeSet> lsvol(InetSocketAddress server,UserCredentials credentials){
  xtreemfs_lsvolRequest rq=new xtreemfs_lsvolRequest();
  RPCResponse<VolumeSet> r=sendRequest(server,rq.getTag(),rq,new RPCResponseDecoder<VolumeSet>(){
    @Override public VolumeSet getResult(    ReusableBuffer data){
      final xtreemfs_lsvolResponse resp=new xtreemfs_lsvolResponse();
      resp.deserialize(data);
      return null;
    }
  }
,credentials);
  return r;
}

Fixed version (ground truth):
public RPCResponse<VolumeSet> lsvol(InetSocketAddress server,UserCredentials credentials){
  xtreemfs_lsvolRequest rq=new xtreemfs_lsvolRequest();
  RPCResponse<VolumeSet> r=sendRequest(server,rq.getTag(),rq,new RPCResponseDecoder<VolumeSet>(){
    @Override public VolumeSet getResult(    ReusableBuffer data){
      final xtreemfs_lsvolResponse resp=new xtreemfs_lsvolResponse();
      resp.deserialize(data);
      return resp.getVolumes();
    }
  }
,credentials);
  return r;
}
Program: 113627
Project: 113627
Buggy source:
public static long readHexLong(final String str,int position){
  long value=OutputUtils.readHexInt(str,position);
  int tmp=OutputUtils.readHexInt(str,position + 8);
  value+=((long)tmp) << 32;
  return value;
}

Fixed version (ground truth):
public static long readHexLong(final String str,int position){
  int low=OutputUtils.readHexInt(str,position);
  int high=OutputUtils.readHexInt(str,position + 8);
  long value=((long)high) << 32 | (((long)low) & 4294967295L);
  return value;
}