Program: 113724
Project: 113724
Buggy source:
@Override public void startRequest(MRCRequest rq){
  try {
    final xtreemfs_update_file_sizeRequest rqArgs=(xtreemfs_update_file_sizeRequest)rq.getRequestArgs();
    Capability cap=new Capability(rqArgs.getXcap(),master.getConfig().getCapabilitySecret());
    if (!cap.hasValidSignature())     throw new UserException(cap + "String_Node_Str");
    if (cap.hasExpired())     throw new UserException(cap + "String_Node_Str");
    long fileId=0;
    String volumeId=null;
    try {
      String globalFileId=cap.getFileId();
      int i=globalFileId.indexOf(':');
      volumeId=globalFileId.substring(0,i);
      fileId=Long.parseLong(globalFileId.substring(i + 1));
    }
 catch (    Exception exc) {
      throw new UserException("String_Node_Str" + cap.getFileId() + "String_Node_Str");
    }
    StorageManager sMan=master.getVolumeManager().getStorageManager(volumeId);
    FileMetadata file=sMan.getMetadata(fileId);
    if (file == null)     throw new UserException(ErrNo.ENOENT,"String_Node_Str" + fileId + "String_Node_Str");
    NewFileSizeSet newFSSet=rqArgs.getOsd_write_response().getNew_file_size();
    if (newFSSet.isEmpty())     throw new UserException(ErrNo.EINVAL,"String_Node_Str");
    NewFileSize newFS=newFSSet.get(0);
    long newFileSize=newFS.getSize_in_bytes();
    int epochNo=newFS.getTruncate_epoch();
    AtomicDBUpdate update=sMan.createAtomicDBUpdate(master,rq);
    if (epochNo >= file.getEpoch()) {
      if (epochNo > file.getEpoch() || newFileSize > file.getSize()) {
        int time=(int)(TimeSync.getGlobalTime() / 1000);
        file.setSize(newFileSize);
        file.setEpoch(epochNo);
        file.setCtime(time);
        file.setMtime(time);
        sMan.setMetadata(file,FileMetadata.FC_METADATA,update);
        sMan.setMetadata(file,FileMetadata.RC_METADATA,update);
      }
    }
 else {
      if (epochNo < file.getEpoch())       if (Logging.isDebug()) {
        Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + epochNo + "String_Node_Str"+ file.getEpoch());
      }
 else       if (Logging.isDebug()) {
        Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + newFileSize + "String_Node_Str"+ file.getSize());
      }
    }
    rq.setResponse(new xtreemfs_update_file_sizeResponse());
    update.execute();
  }
 catch (  UserException exc) {
    Logging.logMessage(Logging.LEVEL_TRACE,this,exc);
    finishRequest(rq,new ErrorRecord(ErrorClass.USER_EXCEPTION,exc.getErrno(),exc.getMessage(),exc));
  }
catch (  Exception exc) {
    finishRequest(rq,new ErrorRecord(ErrorClass.INTERNAL_SERVER_ERROR,"String_Node_Str",exc));
  }
}

Fixed version (ground truth):
@Override public void startRequest(MRCRequest rq){
  try {
    final xtreemfs_update_file_sizeRequest rqArgs=(xtreemfs_update_file_sizeRequest)rq.getRequestArgs();
    Capability cap=new Capability(rqArgs.getXcap(),master.getConfig().getCapabilitySecret());
    if (!cap.hasValidSignature())     throw new UserException(cap + "String_Node_Str");
    if (cap.hasExpired())     throw new UserException(cap + "String_Node_Str");
    long fileId=0;
    String volumeId=null;
    try {
      String globalFileId=cap.getFileId();
      int i=globalFileId.indexOf(':');
      volumeId=globalFileId.substring(0,i);
      fileId=Long.parseLong(globalFileId.substring(i + 1));
    }
 catch (    Exception exc) {
      throw new UserException("String_Node_Str" + cap.getFileId() + "String_Node_Str");
    }
    StorageManager sMan=master.getVolumeManager().getStorageManager(volumeId);
    FileMetadata file=sMan.getMetadata(fileId);
    if (file == null)     throw new UserException(ErrNo.ENOENT,"String_Node_Str" + fileId + "String_Node_Str");
    NewFileSizeSet newFSSet=rqArgs.getOsd_write_response().getNew_file_size();
    if (newFSSet.isEmpty())     throw new UserException(ErrNo.EINVAL,"String_Node_Str");
    NewFileSize newFS=newFSSet.get(0);
    long newFileSize=newFS.getSize_in_bytes();
    int epochNo=newFS.getTruncate_epoch();
    AtomicDBUpdate update=sMan.createAtomicDBUpdate(master,rq);
    if (epochNo >= file.getEpoch()) {
      if (epochNo > file.getEpoch() || newFileSize > file.getSize()) {
        int time=(int)(TimeSync.getGlobalTime() / 1000);
        file.setSize(newFileSize);
        file.setEpoch(epochNo);
        file.setCtime(time);
        file.setMtime(time);
        sMan.setMetadata(file,FileMetadata.FC_METADATA,update);
        sMan.setMetadata(file,FileMetadata.RC_METADATA,update);
      }
    }
 else {
      if (epochNo < file.getEpoch())       if (Logging.isDebug()) {
        Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + epochNo + "String_Node_Str"+ file.getEpoch());
      }
 else       if (Logging.isDebug()) {
        Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + newFileSize + "String_Node_Str"+ file.getSize());
      }
    }
    rq.setResponse(new xtreemfs_update_file_sizeResponse());
    update.execute();
  }
 catch (  UserException exc) {
    Logging.logMessage(Logging.LEVEL_TRACE,this,exc);
    finishRequest(rq,new ErrorRecord(ErrorClass.USER_EXCEPTION,exc.getErrno(),exc.getMessage(),exc));
  }
catch (  Throwable exc) {
    finishRequest(rq,new ErrorRecord(ErrorClass.INTERNAL_SERVER_ERROR,"String_Node_Str",exc));
  }
}