Program: 113795
Project: 113795
Buggy source:
@Override public void startRequest(MRCRequest rq){
  try {
    Args rqArgs=(Args)rq.getRequestArgs();
    final FileAccessManager faMan=master.getFileAccessManager();
    final VolumeManager vMan=master.getVolumeManager();
    long fileId=0;
    String volumeId=null;
    try {
      String globalFileId=rqArgs.fileId;
      int i=globalFileId.indexOf(':');
      volumeId=rqArgs.fileId.substring(0,i);
      fileId=Long.parseLong(rqArgs.fileId.substring(i + 1));
    }
 catch (    Exception exc) {
      throw new UserException("String_Node_Str" + rqArgs.fileId + "String_Node_Str");
    }
    StorageManager sMan=vMan.getStorageManager(volumeId);
    FileMetadata file=sMan.getMetadata(fileId);
    if (file == null)     throw new UserException(ErrNo.ENOENT,"String_Node_Str" + fileId + "String_Node_Str");
    String target=sMan.getSoftlinkTarget(file.getId());
    if (target != null) {
      String path=target;
      Path p=new Path(path);
      if (!vMan.hasVolume(p.getComp(0))) {
        finishRequest(rq,new ErrorRecord(ErrorClass.REDIRECT,target));
        return;
      }
      VolumeInfo volume=vMan.getVolumeByName(p.getComp(0));
      sMan=vMan.getStorageManager(volume.getId());
      PathResolver res=new PathResolver(sMan,p);
      file=res.getFile();
    }
    if (file.isDirectory())     throw new UserException(ErrNo.EPERM,"String_Node_Str");
    faMan.checkPrivilegedPermissions(sMan,file,rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    StripingPolicy sPol=Converter.mapToStripingPolicy(sMan,rqArgs.stripingPolicy);
    if (sPol == null)     sPol=sMan.getDefaultStripingPolicy(file.getId());
    if (sPol == null)     sPol=sMan.getDefaultStripingPolicy(1);
    if (sPol == null)     throw new UserException(ErrNo.EPERM,"String_Node_Str");
    if (!file.isReadOnly())     throw new UserException(ErrNo.EPERM,"String_Node_Str");
    XLocList xLocList=file.getXLocList();
    if (!MRCOpHelper.isAddable(xLocList,rqArgs.osdList))     throw new UserException("String_Node_Str" + JSONParser.writeJSON(Converter.xLocListToList(xLocList)) + "String_Node_Str");
    XLoc replica=sMan.createXLoc(sPol,rqArgs.osdList.toArray(new String[rqArgs.osdList.size()]));
    if (xLocList == null)     xLocList=sMan.createXLocList(new XLoc[]{replica},1);
 else {
      XLoc[] repls=new XLoc[xLocList.getReplicaCount() + 1];
      for (int i=0; i < xLocList.getReplicaCount(); i++)       repls[i]=xLocList.getReplica(i);
      repls[repls.length - 1]=replica;
      xLocList=sMan.createXLocList(repls,xLocList.getVersion() + 1);
    }
    file.setXLocList(xLocList);
    AtomicDBUpdate update=sMan.createAtomicDBUpdate(master,rq);
    sMan.setMetadata(file,FileMetadata.XLOC_METADATA,update);
    rq.setData(ReusableBuffer.wrap(JSONParser.writeJSON(null).getBytes()));
    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 {
    Args rqArgs=(Args)rq.getRequestArgs();
    final FileAccessManager faMan=master.getFileAccessManager();
    final VolumeManager vMan=master.getVolumeManager();
    long fileId=0;
    String volumeId=null;
    try {
      String globalFileId=rqArgs.fileId;
      int i=globalFileId.indexOf(':');
      volumeId=rqArgs.fileId.substring(0,i);
      fileId=Long.parseLong(rqArgs.fileId.substring(i + 1));
    }
 catch (    Exception exc) {
      throw new UserException("String_Node_Str" + rqArgs.fileId + "String_Node_Str");
    }
    StorageManager sMan=vMan.getStorageManager(volumeId);
    FileMetadata file=sMan.getMetadata(fileId);
    if (file == null)     throw new UserException(ErrNo.ENOENT,"String_Node_Str" + fileId + "String_Node_Str");
    String target=sMan.getSoftlinkTarget(file.getId());
    if (target != null) {
      String path=target;
      Path p=new Path(path);
      if (!vMan.hasVolume(p.getComp(0))) {
        finishRequest(rq,new ErrorRecord(ErrorClass.REDIRECT,target));
        return;
      }
      VolumeInfo volume=vMan.getVolumeByName(p.getComp(0));
      sMan=vMan.getStorageManager(volume.getId());
      PathResolver res=new PathResolver(sMan,p);
      file=res.getFile();
    }
    if (file.isDirectory())     throw new UserException(ErrNo.EPERM,"String_Node_Str");
    faMan.checkPrivilegedPermissions(sMan,file,rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    StripingPolicy sPol=Converter.mapToStripingPolicy(sMan,rqArgs.stripingPolicy);
    if (sPol == null)     sPol=sMan.getDefaultStripingPolicy(file.getId());
    if (sPol == null)     sPol=sMan.getDefaultStripingPolicy(1);
    if (sPol == null)     throw new UserException(ErrNo.EPERM,"String_Node_Str");
    if (!file.isReadOnly())     throw new UserException(ErrNo.EPERM,"String_Node_Str");
    XLocList xLocList=file.getXLocList();
    if (!MRCHelper.isAddable(xLocList,rqArgs.osdList))     throw new UserException("String_Node_Str" + JSONParser.writeJSON(Converter.xLocListToList(xLocList)) + "String_Node_Str");
    XLoc replica=sMan.createXLoc(sPol,rqArgs.osdList.toArray(new String[rqArgs.osdList.size()]));
    if (xLocList == null)     xLocList=sMan.createXLocList(new XLoc[]{replica},1);
 else {
      XLoc[] repls=new XLoc[xLocList.getReplicaCount() + 1];
      for (int i=0; i < xLocList.getReplicaCount(); i++)       repls[i]=xLocList.getReplica(i);
      repls[repls.length - 1]=replica;
      xLocList=sMan.createXLocList(repls,xLocList.getVersion() + 1);
    }
    file.setXLocList(xLocList);
    AtomicDBUpdate update=sMan.createAtomicDBUpdate(master,rq);
    sMan.setMetadata(file,FileMetadata.XLOC_METADATA,update);
    rq.setData(ReusableBuffer.wrap(JSONParser.writeJSON(null).getBytes()));
    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));
  }
}