Program: 113704
Project: 113704
Buggy source:
@Override public void startRequest(MRCRequest rq){
  try {
    final VolumeManager vMan=master.getVolumeManager();
    final FileAccessManager faMan=master.getFileAccessManager();
    validateContext(rq);
    final Path p=new Path(rq.getRequestArgs() instanceof unlinkRequest ? ((unlinkRequest)rq.getRequestArgs()).getPath() : ((rmdirRequest)rq.getRequestArgs()).getPath());
    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.O_WRONLY,sMan,res.getParentDir(),0,rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    res.checkIfFileDoesNotExist();
    FileMetadata file=res.getFile();
    faMan.checkPermission(FileAccessManager.NON_POSIX_RM_MV_IN_DIR,sMan,file,res.getParentDirId(),rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    if (file.isDirectory() && sMan.getChildren(file.getId()).hasNext())     throw new UserException(ErrNo.ENOTEMPTY,"String_Node_Str" + p + "String_Node_Str");
    FileCredentialsSet creds=new FileCredentialsSet();
    if (!file.isDirectory()) {
      Capability cap=new Capability(volume.getId() + "String_Node_Str" + file.getId(),FileAccessManager.NON_POSIX_DELETE,Integer.MAX_VALUE,((InetSocketAddress)rq.getRPCRequest().getClientIdentity()).getAddress().getHostAddress(),file.getEpoch(),master.getConfig().getCapabilitySecret());
      XLocList xloc=file.getXLocList();
      if (xloc != null && xloc.getReplicaCount() > 0)       creds.add(new FileCredentials(Converter.xLocListToXLocSet(xloc),cap.getXCap()));
    }
    AtomicDBUpdate update=sMan.createAtomicDBUpdate(master,rq);
    sMan.delete(res.getParentDirId(),res.getFileName(),update);
    if (file.getLinkCount() > 1)     creds.clear();
    MRCHelper.updateFileTimes(res.getParentsParentId(),res.getParentDir(),false,true,true,sMan,update);
    if (file.getLinkCount() > 1)     MRCHelper.updateFileTimes(res.getParentDirId(),file,false,true,false,sMan,update);
    rq.setResponse(new unlinkResponse(creds));
    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 VolumeManager vMan=master.getVolumeManager();
    final FileAccessManager faMan=master.getFileAccessManager();
    validateContext(rq);
    final Path p=new Path(rq.getRequestArgs() instanceof unlinkRequest ? ((unlinkRequest)rq.getRequestArgs()).getPath() : ((rmdirRequest)rq.getRequestArgs()).getPath());
    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.O_WRONLY,sMan,res.getParentDir(),0,rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    res.checkIfFileDoesNotExist();
    FileMetadata file=res.getFile();
    faMan.checkPermission(FileAccessManager.NON_POSIX_RM_MV_IN_DIR,sMan,file,res.getParentDirId(),rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    if (file.isDirectory() && sMan.getChildren(file.getId()).hasNext())     throw new UserException(ErrNo.ENOTEMPTY,"String_Node_Str" + p + "String_Node_Str");
    FileCredentialsSet creds=new FileCredentialsSet();
    if (!file.isDirectory()) {
      Capability cap=new Capability(volume.getId() + "String_Node_Str" + file.getId(),FileAccessManager.NON_POSIX_DELETE,Integer.MAX_VALUE,((InetSocketAddress)rq.getRPCRequest().getClientIdentity()).getAddress().getHostAddress(),file.getEpoch(),master.getConfig().getCapabilitySecret());
      XLocList xloc=file.getXLocList();
      if (xloc != null && xloc.getReplicaCount() > 0)       creds.add(new FileCredentials(Converter.xLocListToXLocSet(xloc),cap.getXCap()));
    }
    AtomicDBUpdate update=sMan.createAtomicDBUpdate(master,rq);
    sMan.delete(res.getParentDirId(),res.getFileName(),update);
    if (file.getLinkCount() > 1)     creds.clear();
    MRCHelper.updateFileTimes(res.getParentsParentId(),res.getParentDir(),false,true,true,sMan,update);
    if (file.getLinkCount() > 1)     MRCHelper.updateFileTimes(res.getParentDirId(),file,false,true,false,sMan,update);
    rq.setResponse(new unlinkResponse(creds));
    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));
  }
}