Program: 113386
Project: 113386
Buggy source:
private void processObjectFetched(StageRequest method){
  try {
    final String fileId=(String)method.getArgs()[0];
    final ObjectVersionMapping record=(ObjectVersionMapping)method.getArgs()[1];
    final InternalObjectData data=(InternalObjectData)method.getArgs()[2];
    final ErrorResponse error=(ErrorResponse)method.getArgs()[3];
    ReplicatedFileState state=files.get(fileId);
    if (state != null) {
      if (error != null) {
        numObjsInFlight--;
        fetchObjects();
        failed(state,error,"String_Node_Str");
      }
 else {
        final int bytes=data.getData().remaining();
        master.getStorageStage().writeObjectWithoutGMax(fileId,record.getObjectNumber(),state.getsPolicy(),0,data.getData(),CowPolicy.PolicyNoCow,null,false,record.getObjectVersion(),null,new WriteObjectCallback(){
          @Override public void writeComplete(          OSDWriteResponse result,          ErrorResponse error){
            if (error != null) {
              Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,"String_Node_Str",ErrorUtils.formatError(error));
            }
          }
        }
);
        master.getPreprocStage().pingFile(fileId);
        master.objectReplicated();
        master.replicatedDataReceived(bytes);
        numObjsInFlight--;
        final int numPendingFile=state.getNumObjectsPending() - 1;
        state.setNumObjectsPending(numPendingFile);
        state.getPolicy().objectFetched(record.getObjectVersion());
        if (Logging.isDebug())         Logging.logMessage(Logging.LEVEL_DEBUG,Category.replication,this,"String_Node_Str",localID,fileId,numPendingFile);
        fetchObjects();
        if (numPendingFile == 0) {
          Logging.logMessage(Logging.LEVEL_DEBUG,Category.replication,this,"String_Node_Str",localID,fileId);
          doOpen(state);
        }
      }
    }
  }
 catch (  Exception ex) {
    Logging.logError(Logging.LEVEL_ERROR,this,ex);
  }
}

Fixed version (ground truth):
private void processObjectFetched(StageRequest method){
  try {
    final String fileId=(String)method.getArgs()[0];
    final ObjectVersionMapping record=(ObjectVersionMapping)method.getArgs()[1];
    final InternalObjectData data=(InternalObjectData)method.getArgs()[2];
    final ErrorResponse error=(ErrorResponse)method.getArgs()[3];
    ReplicatedFileState state=files.get(fileId);
    if (state != null) {
      if (error != null) {
        numObjsInFlight--;
        fetchObjects();
        failed(state,error,"String_Node_Str");
      }
 else       if (data.getData() == null) {
        numObjsInFlight--;
        fetchObjects();
        ErrorResponse generatedError=ErrorResponse.newBuilder().setErrorType(RPC.ErrorType.INTERNAL_SERVER_ERROR).setErrorMessage("String_Node_Str").build();
        failed(state,generatedError,"String_Node_Str");
      }
 else {
        final int bytes=data.getData().remaining();
        master.getStorageStage().writeObjectWithoutGMax(fileId,record.getObjectNumber(),state.getsPolicy(),0,data.getData(),CowPolicy.PolicyNoCow,null,false,record.getObjectVersion(),null,new WriteObjectCallback(){
          @Override public void writeComplete(          OSDWriteResponse result,          ErrorResponse error){
            if (error != null) {
              Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,"String_Node_Str",ErrorUtils.formatError(error));
            }
          }
        }
);
        master.getPreprocStage().pingFile(fileId);
        master.objectReplicated();
        master.replicatedDataReceived(bytes);
        numObjsInFlight--;
        final int numPendingFile=state.getNumObjectsPending() - 1;
        state.setNumObjectsPending(numPendingFile);
        state.getPolicy().objectFetched(record.getObjectVersion());
        if (Logging.isDebug())         Logging.logMessage(Logging.LEVEL_DEBUG,Category.replication,this,"String_Node_Str",localID,fileId,numPendingFile);
        fetchObjects();
        if (numPendingFile == 0) {
          Logging.logMessage(Logging.LEVEL_DEBUG,Category.replication,this,"String_Node_Str",localID,fileId);
          doOpen(state);
        }
      }
    }
  }
 catch (  Exception ex) {
    Logging.logError(Logging.LEVEL_ERROR,this,ex);
  }
}