Make nextString throw a JSONException instead of a NumberFormatExcept…#236
Make nextString throw a JSONException instead of a NumberFormatExcept…#236stleary merged 2 commits intostleary:masterfrom
Conversation
…ion for malformed input.
|
I'd like to see the original |
|
Good idea. Updated the pull request. The error will now look something like this: Exception in thread "main" org.json.JSONException: Illegal escape. at 9 [character 10 line 1] |
|
Looks reasonable. Let me know if you are planning on updating the unit tests. |
|
I didn't see any tests in the repo, so it wasn't clear to me where to add it. I will be happy to add a regression test for this. Is that in a separate repo? |
|
Yeah, they are kept in a separate project: https://github.com/stleary/JSON-Java-unit-test |
|
Thanks. Pull request created for a simple regression test that check that the right type of exception is thrown. |
|
Thank you, will review this evening, if everything seems OK will open a pull request. We generally leave PRs open for about 3 days for comment before merging. |
|
What problem does this code solve? Changes to the API? Will this require a new release? Should the documentation be updated? Change to unit tests? |
…ion for malformed input.
The documentation for the JSONObject(String) constructor says that JSONExceptions are thrown for invalid input. However, the implementation can throw a NumberFormatException as well. This fixes that.