this issue is driving me a little crazy so hopefully one of you fine people could point me in the right direction. I am attempting to prepare a JSONObject that will be passed from client to server. The following is the problematic method stripped down to its essentials:
private JSONObject getJsonParam(int id)
{
JSONObject param = new JSONObject();
try
{
param.put("functionCode", 50);
param.put("id", id);
return param;
}
catch (JSONException e)
{
e.printStackTrace();
}
catch (Throwable e)
{
e.printStackTrace();
}
return null;
}
I have carefully traced the code in debug mode. In the actual method, I put many more paramters in the JSONObject and all is well until the last param.put() method where I attempt to insert the id. When this is the current execution line, I can visualize the param variable and all looks good. Then when I perform the step function to execute the last param.put call, it jumps to the return null statement. I have put breakpoints in both catch blocks and neither are being executed it seems. (I added the second catch block to make sure no other throwable was causing issues).
Any ideas what would be causing this odd behavior? I even tried rearranging the order of the put calls. It does not have any issue with a particular put call, but just the last one before the return statement.
I am working in Android/Java.