Program: 113436
Project: 113436
Buggy source:
private void doPrepareRequest(StageRequest rq){
  final OSDRequest request=(OSDRequest)rq.getArgs()[0];
  final ParseCompleteCallback callback=(ParseCompleteCallback)rq.getCallback();
  numRequests++;
  if (parseRequest(request) == false)   return;
  if (request.getOperation().requiresCapability()) {
    if (Logging.isDebug())     Logging.logMessage(Logging.LEVEL_DEBUG,Category.stage,this,"String_Node_Str");
    ErrorResponse err=processAuthenticate(request);
    if (err != null) {
      callback.parseComplete(request,err);
      if (Logging.isDebug()) {
        Logging.logMessage(Logging.LEVEL_DEBUG,Category.net,this,"String_Node_Str",ErrorUtils.formatError(err));
      }
      return;
    }
  }
  String fileId=request.getFileId();
  if (fileId != null) {
    if (Logging.isDebug())     Logging.logMessage(Logging.LEVEL_DEBUG,Category.stage,this,"String_Node_Str");
    boolean write=request.getCapability() != null && request.getCapability().getSnapConfig() != SnapConfig.SNAP_CONFIG_SNAPS_DISABLED && ((SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_RDWR.getNumber() | SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_TRUNC.getNumber() | SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_WRONLY.getNumber()) & request.getCapability().getAccessMode()) > 0;
    CowPolicy cowPolicy;
    if (oft.contains(fileId)) {
      cowPolicy=oft.refresh(fileId,TimeSync.getLocalSystemTime() + OFT_OPEN_EXTENSION,write);
    }
 else {
      if (request.getCapability() == null || request.getCapability().getSnapConfig() == SnapConfig.SNAP_CONFIG_SNAPS_DISABLED)       cowPolicy=CowPolicy.PolicyNoCow;
 else       cowPolicy=new CowPolicy(cowMode.COW_ONCE);
      oft.openFile(fileId,TimeSync.getLocalSystemTime() + OFT_OPEN_EXTENSION,cowPolicy,write);
      request.setFileOpen(true);
    }
    request.setCowPolicy(cowPolicy);
  }
  callback.parseComplete(request,null);
}

Fixed version (ground truth):
private void doPrepareRequest(StageRequest rq){
  final OSDRequest request=(OSDRequest)rq.getArgs()[0];
  final ParseCompleteCallback callback=(ParseCompleteCallback)rq.getCallback();
  numRequests++;
  if (parseRequest(request) == false)   return;
  if (request.getOperation().requiresCapability()) {
    if (Logging.isDebug())     Logging.logMessage(Logging.LEVEL_DEBUG,Category.stage,this,"String_Node_Str");
    ErrorResponse err=processAuthenticate(request);
    if (err != null) {
      callback.parseComplete(request,err);
      if (Logging.isDebug()) {
        Logging.logMessage(Logging.LEVEL_DEBUG,Category.net,this,"String_Node_Str",ErrorUtils.formatError(err));
      }
      return;
    }
  }
  String fileId=request.getFileId();
  if (fileId != null) {
    if (Logging.isDebug())     Logging.logMessage(Logging.LEVEL_DEBUG,Category.stage,this,"String_Node_Str");
    CowPolicy cowPolicy=CowPolicy.PolicyNoCow;
    if (!(request.getOperation() instanceof DeleteOperation)) {
      boolean write=request.getCapability() != null && request.getCapability().getSnapConfig() != SnapConfig.SNAP_CONFIG_SNAPS_DISABLED && ((SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_RDWR.getNumber() | SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_TRUNC.getNumber() | SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_WRONLY.getNumber()) & request.getCapability().getAccessMode()) > 0;
      if (oft.contains(fileId)) {
        cowPolicy=oft.refresh(fileId,TimeSync.getLocalSystemTime() + OFT_OPEN_EXTENSION,write);
      }
 else {
        if (request.getCapability() == null || request.getCapability().getSnapConfig() == SnapConfig.SNAP_CONFIG_SNAPS_DISABLED)         cowPolicy=CowPolicy.PolicyNoCow;
 else         cowPolicy=new CowPolicy(cowMode.COW_ONCE);
        oft.openFile(fileId,TimeSync.getLocalSystemTime() + OFT_OPEN_EXTENSION,cowPolicy,write);
        request.setFileOpen(true);
      }
    }
    request.setCowPolicy(cowPolicy);
  }
  callback.parseComplete(request,null);
}