Program: 113841
Project: 113841
Buggy source:
@Override public void startRequest(MRCRequest rq){
  try {
    Args rqArgs=(Args)rq.getRequestArgs();
    final VolumeManager vMan=master.getVolumeManager();
    final FileAccessManager faMan=master.getFileAccessManager();
    final Path p=new Path(rqArgs.filePath);
    final VolumeInfo volume=vMan.getVolumeByName(p.getComp(0));
    final StorageManager sMan=vMan.getStorageManager(volume.getId());
    final PathResolver res=new PathResolver(sMan,p);
    faMan.checkSearchPermission(sMan,res,rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    faMan.checkPermission(FileAccessManager.WRITE_ACCESS,sMan,res.getParentDir(),res.getParentsParentId(),rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    res.checkIfFileExistsAlready();
    AtomicDBUpdate update=sMan.createAtomicDBUpdate(master,rq);
    FileMetadata file=sMan.create(res.getParentDirId(),res.getFileName(),rq.getDetails().userId,rq.getDetails().groupIds.get(0),rqArgs.stripingPolicy,rqArgs.mode,null,false,update);
    if (rqArgs.xAttrs != null) {
      for (      Entry<String,Object> attr : rqArgs.xAttrs.entrySet())       sMan.setXAttr(file.getId(),rq.getDetails().userId,attr.getKey(),attr.getValue().toString(),update);
    }
    if (rqArgs.open) {
      String capability=MRCOpHelper.createCapability(AccessMode.w.toString(),volume.getId(),file.getId(),0,master.getConfig().getCapabilitySecret()).toString();
      XLocList xLocList=file.getXLocList();
      if (xLocList == null || !xLocList.iterator().hasNext()) {
        xLocList=MRCOpHelper.createXLocList(xLocList,sMan,master.getOSDStatusManager(),res.toString(),file.getId(),res.getParentDirId(),volume,rq.getPinkyRequest().getClientAddress());
        file.setXLocList(xLocList);
        sMan.setMetadata(file,FileMetadata.XLOC_METADATA,update);
      }
      HTTPHeaders headers=MRCOpHelper.createXCapHeaders(capability,xLocList);
      rq.setAdditionalResponseHeaders(headers);
      MRCOpHelper.updateFileTimes(res.getParentsParentId(),file,!master.getConfig().isNoAtime(),true,true,sMan,update);
      MRCOpHelper.updateFileTimes(res.getParentsParentId(),res.getParentDir(),false,true,true,sMan,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 VolumeManager vMan=master.getVolumeManager();
    final FileAccessManager faMan=master.getFileAccessManager();
    final Path p=new Path(rqArgs.filePath);
    final VolumeInfo volume=vMan.getVolumeByName(p.getComp(0));
    final StorageManager sMan=vMan.getStorageManager(volume.getId());
    final PathResolver res=new PathResolver(sMan,p);
    faMan.checkSearchPermission(sMan,res,rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    faMan.checkPermission(FileAccessManager.WRITE_ACCESS,sMan,res.getParentDir(),res.getParentsParentId(),rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    res.checkIfFileExistsAlready();
    AtomicDBUpdate update=sMan.createAtomicDBUpdate(master,rq);
    FileMetadata file=sMan.create(res.getParentDirId(),res.getFileName(),rq.getDetails().userId,rq.getDetails().groupIds.get(0),rqArgs.stripingPolicy,rqArgs.mode,null,false,update);
    if (rqArgs.xAttrs != null) {
      for (      Entry<String,Object> attr : rqArgs.xAttrs.entrySet())       sMan.setXAttr(file.getId(),rq.getDetails().userId,attr.getKey(),attr.getValue().toString(),update);
    }
    if (rqArgs.open) {
      String capability=MRCOpHelper.createCapability(AccessMode.w.toString(),volume.getId(),file.getId(),0,master.getConfig().getCapabilitySecret()).toString();
      XLocList xLocList=file.getXLocList();
      if (xLocList == null || !xLocList.iterator().hasNext()) {
        xLocList=MRCOpHelper.createXLocList(Converter.mapToStripingPolicy(sMan,rqArgs.stripingPolicy),xLocList,sMan,master.getOSDStatusManager(),res.toString(),file.getId(),res.getParentDirId(),volume,rq.getPinkyRequest().getClientAddress());
        file.setXLocList(xLocList);
        sMan.setMetadata(file,FileMetadata.XLOC_METADATA,update);
      }
      HTTPHeaders headers=MRCOpHelper.createXCapHeaders(capability,xLocList);
      rq.setAdditionalResponseHeaders(headers);
      MRCOpHelper.updateFileTimes(res.getParentsParentId(),file,!master.getConfig().isNoAtime(),true,true,sMan,update);
      MRCOpHelper.updateFileTimes(res.getParentsParentId(),res.getParentDir(),false,true,true,sMan,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));
  }
}