-
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
Minor - JSONObject.put(String Object) throws wrong Exception #402
Comments
I will have a patch for this soon. |
Actually, @stleary, Douglas was the last one to touch both the JavaDoc and the code that throws the exception. He changed it way back in a73066f from throwing a JSONException to throwing the NPE. I'd say we defer to the JavaDoc on this one, but perhaps a simple JavaDoc update is all that's required. Sadly the commit message only really mentions one of many changes that were applied (mostly formatting), so I'm not sure if the code change was intended or not, |
@johnjaylward Thanks for looking up the history. No preference. Leaving the NullPointerException alone is safer, changing to JSONException maintains consistency with the most of the rest of the lib, other than JSONPointer. |
I believe this has been addressed by #405. If you think otherwise, let me know. |
The javadoc states, invoking JSONObject.put(String key, Object value) with a null key should throw a JSONException, however it is throwing a null pointer exception instead.
The text was updated successfully, but these errors were encountered: