Program: 34259
Project: 34259
Buggy source:
/** 
 * Takes an identifier (ripe hash or tag) and requests the corresponding pubkey from a Bitseal server.<br><br> Note: If the pubkey cannot be retrieved after trying all available servers, this method will throw a RuntimeException
 * @param addressString - A String containing the address which we are trying to retrieve the pubkey of
 * @param identifier - A byte[] containing the data used to identify the pubkeywe wish to request. For address versions 3 and below, this is the ripe hash. For address versions 4 and above, this is the 'tag'.
 * @param addressVersion - An int containing the version number of the address forwhich we are requesting the pubkey
 * @return A Pubkey object conatining the requested pubkey
 */
public Pubkey requestPubkeyFromServer(String addressString,byte[] identifier,int addressVersion){
  Log.d(TAG,"String_Node_Str" + addressString);
  String hexPayload=ByteFormatter.byteArrayToHexString(identifier);
  ApiCaller caller=new ApiCaller();
  int serversToPoll=caller.getNumberOfServers();
  if (serversToPoll > MAX_SERVERS_TO_POLL) {
    serversToPoll=MAX_SERVERS_TO_POLL;
  }
  for (int i=0; i < serversToPoll; i++) {
    Object callResult=caller.call(API_METHOD_REQUEST_PUBKEY,hexPayload,addressVersion);
    String resultString=callResult.toString();
    Log.d(TAG,"String_Node_Str" + resultString);
    if ((resultString.equals(RESULT_CODE_REQUEST_PUBKEY)) == false) {
      try {
        JSONObject jObject=new JSONObject(resultString);
        JSONArray jArray=jObject.getJSONArray(JSON_NAME_PUBKEY_PAYLOAD);
        JSONObject object=jArray.getJSONObject(0);
        String pubkeyHex=object.getString(JSON_NAME_DATA);
        long payloadByteSize=pubkeyHex.length() / 2;
        if (payloadByteSize < MAX_PAYLOAD_SIZE_TO_ACCEPT) {
          byte[] pubkeyData=ByteFormatter.hexStringToByteArray(pubkeyHex);
          PubkeyProcessor pubProc=new PubkeyProcessor();
          Pubkey pubkey=pubProc.reconstructPubkey(pubkeyData,addressString);
          boolean pubkeyValid=pubProc.validatePubkey(pubkey,addressString);
          if (pubkeyValid == false) {
            Log.i(TAG,"String_Node_Str" + "String_Node_Str" + addressString + "String_Node_Str"+ "String_Node_Str");
            caller.switchToNextServer();
          }
 else {
            return pubkey;
          }
        }
 else {
          long payloadKilobytes=payloadByteSize / 1000;
          Log.d(TAG,"String_Node_Str" + "String_Node_Str" + "String_Node_Str" + payloadKilobytes + "String_Node_Str");
        }
      }
 catch (      JSONException e) {
        throw new RuntimeException("String_Node_Str" + "String_Node_Str" + e.getLocalizedMessage() + "String_Node_Str"+ "String_Node_Str"+ resultString);
      }
    }
 else {
      try {
        caller.switchToNextServer();
      }
 catch (      RuntimeException e) {
        break;
      }
    }
  }
  throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Takes an identifier (ripe hash or tag) and requests the corresponding pubkey from a Bitseal server.<br><br> Note: If the pubkey cannot be retrieved after trying all available servers, this method will throw a RuntimeException
 * @param addressString - A String containing the address which we are trying to retrieve the pubkey of
 * @param identifier - A byte[] containing the data used to identify the pubkeywe wish to request. For address versions 3 and below, this is the ripe hash. For address versions 4 and above, this is the 'tag'.
 * @param addressVersion - An int containing the version number of the address forwhich we are requesting the pubkey
 * @return A Pubkey object containing the requested pubkey
 */
public Pubkey requestPubkeyFromServer(String addressString,byte[] identifier,int addressVersion){
  Log.d(TAG,"String_Node_Str" + addressString);
  String hexPayload=ByteFormatter.byteArrayToHexString(identifier);
  ApiCaller caller=new ApiCaller();
  int serversToPoll=caller.getNumberOfServers();
  if (serversToPoll > MAX_SERVERS_TO_POLL) {
    serversToPoll=MAX_SERVERS_TO_POLL;
  }
  for (int i=0; i < serversToPoll; i++) {
    Object callResult=caller.call(API_METHOD_REQUEST_PUBKEY,hexPayload,addressVersion);
    String resultString=callResult.toString();
    Log.d(TAG,"String_Node_Str" + resultString);
    if ((resultString.equals(RESULT_CODE_REQUEST_PUBKEY)) == false) {
      try {
        JSONObject jObject=new JSONObject(resultString);
        JSONArray jArray=jObject.getJSONArray(JSON_NAME_PUBKEY_PAYLOAD);
        JSONObject object=jArray.getJSONObject(0);
        String pubkeyHex=object.getString(JSON_NAME_DATA);
        long payloadByteSize=pubkeyHex.length() / 2;
        if (payloadByteSize < MAX_PAYLOAD_SIZE_TO_ACCEPT) {
          byte[] pubkeyData=ByteFormatter.hexStringToByteArray(pubkeyHex);
          PubkeyProcessor pubProc=new PubkeyProcessor();
          Pubkey pubkey=pubProc.reconstructPubkey(pubkeyData,addressString);
          boolean pubkeyValid=pubProc.validatePubkey(pubkey,addressString);
          if (pubkeyValid == false) {
            Log.i(TAG,"String_Node_Str" + "String_Node_Str" + addressString + "String_Node_Str"+ "String_Node_Str");
            caller.switchToNextServer();
          }
 else {
            return pubkey;
          }
        }
 else {
          long payloadKilobytes=payloadByteSize / 1000;
          Log.d(TAG,"String_Node_Str" + "String_Node_Str" + "String_Node_Str" + payloadKilobytes + "String_Node_Str");
        }
      }
 catch (      JSONException e) {
        throw new RuntimeException("String_Node_Str" + "String_Node_Str" + e.getLocalizedMessage() + "String_Node_Str"+ "String_Node_Str"+ resultString);
      }
    }
 else {
      try {
        caller.switchToNextServer();
      }
 catch (      RuntimeException e) {
        break;
      }
    }
  }
  throw new RuntimeException("String_Node_Str");
}