Program: 32362
Project: 32362
Buggy source:
/** 
 * Debug method to try to extract the RPC hash from the packet payload. Should only be used while debugging, not in production. Currently it will only handle single frame RPCs
 * @param packet to inspect
 * @return The Hashtable to be used to construct an RPC
 */
public static Hashtable<String,Object> getRPCHash(SdlPacket packet){
  if (packet == null || packet.getFrameType().getValue() != SdlPacket.FRAME_TYPE_SINGLE || packet.getServiceType() != SdlPacket.SERVICE_TYPE_RPC) {
    Log.w("String_Node_Str","String_Node_Str");
    return null;
  }
  int version=packet.getVersion();
  ProtocolMessage message=new ProtocolMessage();
  SessionType serviceType=SessionType.valueOf((byte)packet.getServiceType());
  if (serviceType == SessionType.RPC) {
    message.setMessageType(MessageType.RPC);
  }
 else   if (serviceType == SessionType.BULK_DATA) {
    message.setMessageType(MessageType.BULK);
  }
  message.setSessionType(serviceType);
  message.setSessionID((byte)packet.getSessionId());
  if (version > 1) {
    BinaryFrameHeader binFrameHeader=BinaryFrameHeader.parseBinaryHeader(packet.getPayload());
    message.setVersion((byte)version);
    message.setRPCType(binFrameHeader.getRPCType());
    message.setFunctionID(binFrameHeader.getFunctionID());
    message.setCorrID(binFrameHeader.getCorrID());
    if (binFrameHeader.getJsonSize() > 0) {
      message.setData(binFrameHeader.getJsonData());
    }
    if (binFrameHeader.getBulkData() != null) {
      message.setBulkData(binFrameHeader.getBulkData());
    }
  }
 else {
    message.setData(packet.getPayload());
  }
  Hashtable<String,Object> hash=new Hashtable<String,Object>();
  if (packet.getVersion() > 1) {
    Hashtable<String,Object> hashTemp=new Hashtable<String,Object>();
    hashTemp.put(RPCMessage.KEY_CORRELATION_ID,message.getCorrID());
    if (message.getJsonSize() > 0) {
      final Hashtable<String,Object> mhash=JsonRPCMarshaller.unmarshall(message.getData());
      hashTemp.put(RPCMessage.KEY_PARAMETERS,mhash);
    }
    String functionName=FunctionID.getFunctionName(message.getFunctionID());
    if (functionName != null) {
      hashTemp.put(RPCMessage.KEY_FUNCTION_NAME,functionName);
    }
 else {
      return null;
    }
    if (message.getRPCType() == 0x00) {
      hash.put(RPCMessage.KEY_REQUEST,hashTemp);
    }
 else     if (message.getRPCType() == 0x01) {
      hash.put(RPCMessage.KEY_RESPONSE,hashTemp);
    }
 else     if (message.getRPCType() == 0x02) {
      hash.put(RPCMessage.KEY_NOTIFICATION,hashTemp);
    }
    if (message.getBulkData() != null)     hash.put(RPCStruct.KEY_BULK_DATA,message.getBulkData());
  }
 else {
    final Hashtable<String,Object> mhash=JsonRPCMarshaller.unmarshall(message.getData());
    hash=mhash;
  }
  return hash;
}

Fixed version (ground truth):
/** 
 * Debug method to try to extract the RPC hash from the packet payload. Should only be used while debugging, not in production. Currently it will only handle single frame RPCs
 * @param packet to inspect
 * @return The Hashtable to be used to construct an RPC
 */
public static Hashtable<String,Object> getRPCHash(SdlPacket packet){
  if (packet == null || packet.getFrameType().getValue() != SdlPacket.FRAME_TYPE_SINGLE || packet.getServiceType() != SdlPacket.SERVICE_TYPE_RPC) {
    Log.w("String_Node_Str","String_Node_Str");
    return null;
  }
  int version=packet.getVersion();
  ProtocolMessage message=new ProtocolMessage();
  SessionType serviceType=SessionType.valueOf((byte)packet.getServiceType());
  if (serviceType == SessionType.RPC) {
    message.setMessageType(MessageType.RPC);
  }
 else   if (serviceType == SessionType.BULK_DATA) {
    message.setMessageType(MessageType.BULK);
  }
  message.setSessionType(serviceType);
  message.setSessionID((byte)packet.getSessionId());
  if (version > 1) {
    BinaryFrameHeader binFrameHeader=BinaryFrameHeader.parseBinaryHeader(packet.getPayload());
    if (binFrameHeader == null) {
      return null;
    }
    message.setVersion((byte)version);
    message.setRPCType(binFrameHeader.getRPCType());
    message.setFunctionID(binFrameHeader.getFunctionID());
    message.setCorrID(binFrameHeader.getCorrID());
    if (binFrameHeader.getJsonSize() > 0) {
      message.setData(binFrameHeader.getJsonData());
    }
    if (binFrameHeader.getBulkData() != null) {
      message.setBulkData(binFrameHeader.getBulkData());
    }
  }
 else {
    message.setData(packet.getPayload());
  }
  Hashtable<String,Object> hash=new Hashtable<String,Object>();
  if (packet.getVersion() > 1) {
    Hashtable<String,Object> hashTemp=new Hashtable<String,Object>();
    hashTemp.put(RPCMessage.KEY_CORRELATION_ID,message.getCorrID());
    if (message.getJsonSize() > 0) {
      final Hashtable<String,Object> mhash=JsonRPCMarshaller.unmarshall(message.getData());
      hashTemp.put(RPCMessage.KEY_PARAMETERS,mhash);
    }
    String functionName=FunctionID.getFunctionName(message.getFunctionID());
    if (functionName != null) {
      hashTemp.put(RPCMessage.KEY_FUNCTION_NAME,functionName);
    }
 else {
      return null;
    }
    if (message.getRPCType() == 0x00) {
      hash.put(RPCMessage.KEY_REQUEST,hashTemp);
    }
 else     if (message.getRPCType() == 0x01) {
      hash.put(RPCMessage.KEY_RESPONSE,hashTemp);
    }
 else     if (message.getRPCType() == 0x02) {
      hash.put(RPCMessage.KEY_NOTIFICATION,hashTemp);
    }
    if (message.getBulkData() != null)     hash.put(RPCStruct.KEY_BULK_DATA,message.getBulkData());
  }
 else {
    final Hashtable<String,Object> mhash=JsonRPCMarshaller.unmarshall(message.getData());
    hash=mhash;
  }
  return hash;
}