-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make nextString throw a JSONException instead of a NumberFormatExcept… #236
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.