You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While using Jackson with JAXB bindings, I found deserialization behaves unexpectedly on empty or self-closing elements: it sets sub-fields as null no matter what.
Here's a class to reproduce the issue (sorry if it's big):
Now I'm anything but a JAXB or Jackson expert, so I definitely may have done mistakes or misconfigured my mapper or POJOs, in that case, any hint is appreciated.
To my surprise, <wrapper><pojos></pojos></wrapper> returns a nullPojos object, while <wrapper></wrapper> returns an instance of Pojos (as you can see in testWrapperWithoutPojos test).
I think this is a bug.
Dependencies to ensure we test in the same conditions:
org.projectlombok:lombok:jar:1.16.14
org.mockito:mockito-core:jar:2.7.9
com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.9.0.pr4
com.fasterxml.jackson.core:jackson-core:jar:2.9.0.pr4
com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0.pr4
com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.9.0.pr4
Note I also tried with jackson 2.8.9 version (for all Jackson-related libraries obviously) without this line:
Thank you for reporting this, as per discussions.
I probably should have mentioned this earlier, but since this is related to XML, it needs to go in issue tracker of jackson-dataformat-xml.
One other thing: I don't accept code that relies on Lombok any more, since it does not work without adding Lombok jar in classpath. So those would need to be written out (may be as minimal as possible).
This should not change behavior, just makes it possible to just d/l repo, build with vanilla Maven.
(if a solution is found where pom.xml can have definitions that remove need to install anything that'd also work -- I haven't seen such a thing for Lombok)
Apologies for inconvenience.
Following discussion between @allienna and @cowtowncoder on #1402 I'm creating an issue.
Hi guys,
While using Jackson with JAXB bindings, I found deserialization behaves unexpectedly on empty or self-closing elements: it sets sub-fields as null no matter what.
Here's a class to reproduce the issue (sorry if it's big):
If you run it, you will see that 2 tests fail:
testWrapperWithoutValues
testWrapperWithSelfClosingPojos
Now I'm anything but a JAXB or Jackson expert, so I definitely may have done mistakes or misconfigured my mapper or POJOs, in that case, any hint is appreciated.
To my surprise,
<wrapper><pojos></pojos></wrapper>
returns anull
Pojos
object, while<wrapper></wrapper>
returns an instance ofPojos
(as you can see intestWrapperWithoutPojos
test).I think this is a bug.
Dependencies to ensure we test in the same conditions:
org.projectlombok:lombok:jar:1.16.14
org.mockito:mockito-core:jar:2.7.9
com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.9.0.pr4
com.fasterxml.jackson.core:jackson-core:jar:2.9.0.pr4
com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0.pr4
com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.9.0.pr4
Note I also tried with jackson 2.8.9 version (for all Jackson-related libraries obviously) without this line:
and the problem remains.
The text was updated successfully, but these errors were encountered: