Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Empty ImmutableMap Objects Are Not Deserialized Correctly by GuavaMapDeserializer.java #29

Closed
pbergn opened this issue Oct 1, 2013 · 4 comments
Milestone

Comments

@pbergn
Copy link

pbergn commented Oct 1, 2013

The GuavaMapDeserializer#deserialize() method does not correctly deserialize empty ImmutableMap object instances when they are nested as bean properties and have a "@Class" identifier as the first key/value pair in the enclosing curly braces. Note that "empty" implies that there are no additional key/value pairs after the class identifier in question, which results in parsing error.

More specifically, the parsing issue stems from the check on line 120 where, JsonToken.END_OBJECT is NOT considered as a legitimate first token, and a run-time exception is raised. Note that the regular MapDeserializer class DOES permit the END_OBJECT token as a legitimate first token.

@cowtowncoder
Copy link
Member

Thanks. I will try to reproduce the problem, should be easy enough to fix.

@cowtowncoder
Copy link
Member

Looks like polymorphic type info is indeed needed; plain old "{ }" does not cause problems in itself.

@cowtowncoder
Copy link
Member

Ok, finally able to reproduce this.

@cowtowncoder
Copy link
Member

Fixed, will be included in 2.3.0.

Thank you for reporting this issue: I also checked that ImmutableSet should work; let us know if you find other problem cases.

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

No branches or pull requests

2 participants