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
Bug with polymorphic marshalling / unmarshalling objects with composite structure. #234
Comments
|
Is any news related to this issue? Will it be fixed in 2.3 version? |
Trying out the provided test (slightly simplified, I edited sample above). I can replicate failure of Map handling. My first guess is that this is probably due to nested nature of types and handlers. I hope it is something that can be resolved. |
One thing I note is the inclusion mechanism used: use of |
Serialization is incorrect in failing test case: values in I will try to figure out why type info inclusion is incorrectly determined. |
Following code flow, the problems comes form dynamic discovery of serializers for Map entries; runtime (type-erased) type of I'll see if I can find a simple fix here (plausible), or if a bigger rework is needed. |
Ok. Looks like this has similar root cause as: http://jira.codehaus.org/browse/JACKSON-508 but only affects one specific code path: that of a generic type as a value of Map. Good thing is that this should actually be possible to fix easily and reliably. |
Backport fix in 1.9.x as well (for 1.9.14), but note that there is no firm release schedule for 1.9.x, and this is the first fix since 1.9.13. So it may take a while until new version is released there -- in the meantime, you may want to do local build if you need a fixed version. |
Thanks a lot for you work. It is very useful. |
You are welcome! |
It is the copy of http://jira.codehaus.org/browse/JACKSON-896
There is a bug with polymorphic marshalling / unmarshalling objects with composite structure.
Using ObjectMapper.DefaultTyping.OBJECT_AND_NON_CONCRETE setting can't guarantee correct marshalling for classes with quite a complex structure. The test case is in the attached file http://jira.codehaus.org/secure/attachment/62953/jackson.zip. There you can find class ItemMap with field private Map<String, List> childItems;. After trying to unmarshall such an object we will catch an exception:
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "@Class" (class ItemMap), not marked as ignorable (2 known properties: , "childItems", "value"])
at [Source: java.io.StringReader@4cd67e21; line: 1, column: 110](through reference chain: ItemMap["childItems"]->ItemMap["@Class"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:79)
P.S. In our legacy system we use version 1.9 and 2.1. in the new one, so it will be great to have fixes for both branches.
The text was updated successfully, but these errors were encountered: