Program: 99051
Project: 99051
Buggy source:
/** 
 * Client-side handler for RPC Result packets. Logs a message to the console (unless this is a reply to a session id request) and calls the relevant callback (if it exists) dependent on whether status of the result is SUCCESS.
 * @param from
 * @param pkt
 */
private void handleRPCresult(Integer from,RPCResultPacket pkt){
  RPCRequest request=requestQueue.peek();
  if (pkt.getRequestID() != request.getPacket().getRequestID()) {
    return;
  }
  Status status=pkt.getStatus();
  Command requestType=request.getPacket().getRequest();
  if (requestType == Command.SESSION) {
    if (status == Status.SUCCESS) {
      serverSessionID=Integer.parseInt(Utility.byteArrayToString(pkt.getPayload()));
      requestQueue.poll();
    }
  }
 else {
    requestQueue.poll();
    Callback callback;
    if (status == Status.SUCCESS) {
      callback=request.getSuccess();
      logOutput("String_Node_Str" + this.addr + "String_Node_Str"+ requestType+ "String_Node_Str"+ request.getServerAddr()+ "String_Node_Str"+ request.getFilename());
      if (requestType == Command.GET) {
        logOutput(Utility.byteArrayToString(pkt.getPayload()));
      }
    }
 else {
      if (status == Status.CRASH) {
        serverSessionID=Integer.parseInt(Utility.byteArrayToString(pkt.getPayload()));
      }
      callback=request.getFailure();
      logError("String_Node_Str" + this.addr + "String_Node_Str"+ requestType+ "String_Node_Str"+ request.getServerAddr()+ "String_Node_Str"+ request.getFilename()+ "String_Node_Str"+ status.toString());
    }
    if (callback != null) {
      try {
        callback.invoke();
      }
 catch (      IllegalAccessException e) {
        e.printStackTrace();
      }
catch (      InvocationTargetException e) {
        e.printStackTrace();
      }
    }
  }
  sendNextRequest();
}

Fixed version (ground truth):
/** 
 * Client-side handler for RPC Result packets. Logs a message to the console (unless this is a reply to a session id request) and calls the relevant callback (if it exists) dependent on whether status of the result is SUCCESS.
 * @param from
 * @param pkt
 */
private void handleRPCresult(Integer from,RPCResultPacket pkt){
  RPCRequest request=requestQueue.peek();
  if (request == null || pkt.getRequestID() != request.getPacket().getRequestID()) {
    return;
  }
  Status status=pkt.getStatus();
  Command requestType=request.getPacket().getRequest();
  if (requestType == Command.SESSION) {
    if (status == Status.SUCCESS) {
      serverSessionID=Integer.parseInt(Utility.byteArrayToString(pkt.getPayload()));
      requestQueue.poll();
    }
  }
 else {
    requestQueue.poll();
    Callback callback;
    if (status == Status.SUCCESS) {
      callback=request.getSuccess();
      logOutput("String_Node_Str" + this.addr + "String_Node_Str"+ requestType+ "String_Node_Str"+ request.getServerAddr()+ "String_Node_Str"+ request.getFilename());
      if (requestType == Command.GET) {
        logOutput(Utility.byteArrayToString(pkt.getPayload()));
      }
    }
 else {
      if (status == Status.CRASH) {
        serverSessionID=Integer.parseInt(Utility.byteArrayToString(pkt.getPayload()));
      }
      callback=request.getFailure();
      logError("String_Node_Str" + this.addr + "String_Node_Str"+ requestType+ "String_Node_Str"+ request.getServerAddr()+ "String_Node_Str"+ request.getFilename()+ "String_Node_Str"+ status.toString());
    }
    if (callback != null) {
      try {
        callback.invoke();
      }
 catch (      IllegalAccessException e) {
        e.printStackTrace();
      }
catch (      InvocationTargetException e) {
        e.printStackTrace();
      }
    }
  }
  sendNextRequest();
}