Skip to content
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

Confusing Exceptions #1247

Open
havrikov opened this issue Feb 3, 2018 · 0 comments · May be fixed by #2152
Open

Confusing Exceptions #1247

havrikov opened this issue Feb 3, 2018 · 0 comments · May be fixed by #2152
Labels

Comments

@havrikov
Copy link

havrikov commented Feb 3, 2018

When trying to deserialize the values [[{},null],false,false] and [[null,false],null,true] with the code (new Gson()).fromJson(x, Map.class); two confusing exceptions are thrown:
java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap is not Comparable and
java.lang.NullPointerException: key == null, respectively.

Such exceptions should not be thrown to the user. Instead, one would expect these cases to be reported with an IllegalArgumentException.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants