Skip to content

Confusing Exceptions #1247

@havrikov

Description

@havrikov

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions