Program: 113735
Project: 113735
Buggy source:
@Override public void startRequest(MRCRequest rq){
  try {
    final readdirRequest rqArgs=(readdirRequest)rq.getRequestArgs();
    final VolumeManager vMan=master.getVolumeManager();
    final FileAccessManager faMan=master.getFileAccessManager();
    validateContext(rq);
    Path p=new Path(rqArgs.getPath());
    VolumeInfo volume=vMan.getVolumeByName(p.getComp(0));
    StorageManager sMan=vMan.getStorageManager(volume.getId());
    PathResolver res=new PathResolver(sMan,p);
    faMan.checkSearchPermission(sMan,res,rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    res.checkIfFileDoesNotExist();
    FileMetadata file=res.getFile();
    String target=sMan.getSoftlinkTarget(file.getId());
    if (target != null) {
      rqArgs.setPath(target);
      p=new Path(target);
      if (!vMan.hasVolume(p.getComp(0))) {
        finishRequest(rq,new ErrorRecord(ErrorClass.USER_EXCEPTION,ErrNo.ENOENT,"String_Node_Str" + target + "String_Node_Str"));
        return;
      }
      volume=vMan.getVolumeByName(p.getComp(0));
      sMan=vMan.getStorageManager(volume.getId());
      res=new PathResolver(sMan,p);
      file=res.getFile();
    }
    faMan.checkPermission(FileAccessManager.O_RDONLY,sMan,file,res.getParentDirId(),rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    AtomicDBUpdate update=sMan.createAtomicDBUpdate(master,rq);
    if (!master.getConfig().isNoAtime())     MRCHelper.updateFileTimes(res.getParentDirId(),file,true,false,false,sMan,update);
    DirectoryEntrySet dirContent=new DirectoryEntrySet();
    Iterator<FileMetadata> it=sMan.getChildren(res.getFile().getId());
    while (it.hasNext()) {
      FileMetadata child=it.next();
      String linkTarget=sMan.getSoftlinkTarget(child.getId());
      int mode=faMan.getPosixAccessMode(sMan,child,rq.getDetails().userId,rq.getDetails().groupIds);
      mode|=linkTarget != null ? Constants.SYSTEM_V_FCNTL_S_IFLNK : child.isDirectory() ? Constants.SYSTEM_V_FCNTL_S_IFDIR : Constants.SYSTEM_V_FCNTL_S_IFREG;
      long size=linkTarget != null ? linkTarget.length() : file.isDirectory() ? 0 : child.getSize();
      int type=linkTarget != null ? 3 : child.isDirectory() ? 2 : 1;
      stat_ stat=new stat_(mode,child.getLinkCount(),1,1,0,size,child.getAtime(),child.getMtime(),child.getCtime(),child.getOwnerId(),child.getOwningGroupId(),volume.getId() + "String_Node_Str" + child.getId(),linkTarget,type,child.getEpoch(),(int)child.getW32Attrs());
      dirContent.add(new DirectoryEntry(child.getFileName(),stat,linkTarget));
    }
    rq.setResponse(new readdirResponse(dirContent));
    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 readdirRequest rqArgs=(readdirRequest)rq.getRequestArgs();
    final VolumeManager vMan=master.getVolumeManager();
    final FileAccessManager faMan=master.getFileAccessManager();
    validateContext(rq);
    Path p=new Path(rqArgs.getPath());
    VolumeInfo volume=vMan.getVolumeByName(p.getComp(0));
    StorageManager sMan=vMan.getStorageManager(volume.getId());
    PathResolver res=new PathResolver(sMan,p);
    faMan.checkSearchPermission(sMan,res,rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    res.checkIfFileDoesNotExist();
    FileMetadata file=res.getFile();
    String target=sMan.getSoftlinkTarget(file.getId());
    if (target != null) {
      rqArgs.setPath(target);
      p=new Path(target);
      if (!vMan.hasVolume(p.getComp(0))) {
        finishRequest(rq,new ErrorRecord(ErrorClass.USER_EXCEPTION,ErrNo.ENOENT,"String_Node_Str" + target + "String_Node_Str"));
        return;
      }
      volume=vMan.getVolumeByName(p.getComp(0));
      sMan=vMan.getStorageManager(volume.getId());
      res=new PathResolver(sMan,p);
      file=res.getFile();
    }
    faMan.checkPermission(FileAccessManager.O_RDONLY,sMan,file,res.getParentDirId(),rq.getDetails().userId,rq.getDetails().superUser,rq.getDetails().groupIds);
    AtomicDBUpdate update=sMan.createAtomicDBUpdate(master,rq);
    if (!master.getConfig().isNoAtime())     MRCHelper.updateFileTimes(res.getParentDirId(),file,true,false,false,sMan,update);
    DirectoryEntrySet dirContent=new DirectoryEntrySet();
    Iterator<FileMetadata> it=sMan.getChildren(res.getFile().getId());
    while (it.hasNext()) {
      FileMetadata child=it.next();
      String linkTarget=sMan.getSoftlinkTarget(child.getId());
      int mode=faMan.getPosixAccessMode(sMan,child,rq.getDetails().userId,rq.getDetails().groupIds);
      mode|=linkTarget != null ? Constants.SYSTEM_V_FCNTL_S_IFLNK : child.isDirectory() ? Constants.SYSTEM_V_FCNTL_S_IFDIR : Constants.SYSTEM_V_FCNTL_S_IFREG;
      long size=linkTarget != null ? linkTarget.length() : child.isDirectory() ? 0 : child.getSize();
      int type=linkTarget != null ? 3 : child.isDirectory() ? 2 : 1;
      stat_ stat=new stat_(mode,child.getLinkCount(),1,1,0,size,child.getAtime(),child.getMtime(),child.getCtime(),child.getOwnerId(),child.getOwningGroupId(),volume.getId() + "String_Node_Str" + child.getId(),linkTarget,type,child.getEpoch(),(int)child.getW32Attrs());
      dirContent.add(new DirectoryEntry(child.getFileName(),stat,linkTarget));
    }
    rq.setResponse(new readdirResponse(dirContent));
    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));
  }
}