In this part of the code
|
try { |
|
responseJSON = new JSONObject(errResp); |
|
} catch (JSONException e) { |
|
// If errResp is not valid JSON, create a new JSONObject with the error message |
|
responseJSON = new JSONObject(); |
|
responseJSON.put(ERROR_MESSAGE, errResp); |
|
} |
|
responseJSON.put(ERROR_MESSAGE, responseJSON.optString(ERROR_MESSAGE)); |
|
responseJSON.put(ERROR_CODE, responseJSON.optString(ERROR_CODE)); |
|
responseJSON.put(ERRORS, responseJSON.optString(ERRORS)); |
|
int errCode = Integer.parseInt(responseJSON.optString(ERROR_CODE)); |
when there is an JSONException, a "fake" JSONObject is created. That object does not contain an error code.
later when int errCode = Integer.parseInt(responseJSON.optString(ERROR_CODE)); is executed an java.lang.NumberFormatException: For input string: "" exception is triggered.
In this part of the code
contentstack-java/src/main/java/com/contentstack/sdk/CSHttpConnection.java
Lines 298 to 308 in 5e09340
when there is an
JSONException, a "fake"JSONObjectis created. That object does not contain an error code.later when
int errCode = Integer.parseInt(responseJSON.optString(ERROR_CODE));is executed anjava.lang.NumberFormatException: For input string: ""exception is triggered.