-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
In this part of the code
contentstack-java/src/main/java/com/contentstack/sdk/CSHttpConnection.java
Lines 298 to 308 in 5e09340
| 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.
Metadata
Metadata
Assignees
Labels
No labels