-
-
Notifications
You must be signed in to change notification settings - Fork 229
Problem deserializing POJO with unwrapped List
, ignorable attribute value
#301
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
Comments
Maybe related to #294 |
I looked at the Jackson code. In class "com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser", there is the following code in the method "nextToken()" :
where "_namesToWrap" contains the property lists that have "useWrapping = false". The problem is that when we are parsing "<MY_PROPERTY>12.34</MY_PROPERTY>" of "CHILDB", the list "_namesToWrap" contains "MY_PROPERTY" and "CHILD_B", so it considers that "MY_PROPERTY" should be an unwrapped list instead of a Double value. I think the problem is that the property "_namesToWrap" is not up to date in that part of the code. It works if I replace the code with the following :
PS : I was willing to do a PR, but there are several tests that do not pass (EnumIssue9Test for example) when I retrieved the code, so I don't really know if it creates regressions. |
@JulienHoueix - Please advise if you found a workaround for this issue. |
No |
you can use json and include your attributes in an object |
(removed some intermediate comments) Looking at structure, the real problem seems to be that
is in <PARENT>
<CHILDB MY_ATTR='TEST_VALUE'>
<MY_PROPERTY>12.34</MY_PROPERTY>
</CHILDB>
</PARENT> expects it for So I think this is fixed for 2.11.1 (to be released) at least, possibly earlier. Not sure which of fixes since 2.9.6 it would be (there are a few), but will mark fixed for 2.11.1 |
List
, ignorable attribute value
Hello,
I encountered a bug during XML deserialization with Jackson 2.9.6
If I have a parent class that :
I get the following error when I try to serialize the XML :
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of
java.lang.Double
out of START_OBJECT tokenat [Source: (StringReader); line: 1, column: 44] (through reference chain: ch.hcuge.deja.drug.client.Parent["CHILDB"]->java.util.ArrayList[0]->ch.hcuge.deja.drug.client.ChildB["MY_PROPERTY"])
But I have this error only if the parent object contains an attribute!
I have a test case that shows the problem :
The text was updated successfully, but these errors were encountered: