Skip to content
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

Jackson 2.10.x fails to deserialize xsi:nil with multiple child elements #378

Closed
henrik242 opened this issue Dec 17, 2019 · 8 comments
Closed
Milestone

Comments

@henrik242
Copy link

henrik242 commented Dec 17, 2019

This XML:

<Silly xmlns:a="http://www.w3.org/2001/XMLSchema-instance" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <a:Hey i:nil="true"/>
  <a:Ho>to</a:Ho>
</Silly>

.. fails to properly deserialize in Jackson 2.10.x. Both Hey and Ho are null, while in 2.9.9 they were "" and "to".

See test project at https://github.com/henrik242/jackson-xml-problem/tree/jackson-xml-nil-problem

First reported in #354 (comment) and #358 (comment)

@henrik242 henrik242 changed the title Jackson 2.10.x fails to deserialize xsi:nil Jackson 2.10.x fails to deserialize xsi:nil when schema is http://www.w3.org/2001/XMLSchema-instance Dec 17, 2019
@henrik242
Copy link
Author

Happy new year! Any ideas to a workaround or fix for this, @cowtowncoder ?

@cowtowncoder
Copy link
Member

Happy new year!

No, unfortunately I have not had time to work on xml module. But I think I can probably add a failing test for this soon at least.

cowtowncoder added a commit that referenced this issue Jan 4, 2020
@cowtowncoder
Copy link
Member

Hmmh. Ok, from some digging it looks like second element gets skipped for some reason.

@henrik242
Copy link
Author

henrik242 commented Jan 4, 2020

Happy new year! Weird. It's got something to do with using the http://www.w3.org/2001/XMLSchema-instance schema, at least.

@cowtowncoder
Copy link
Member

Sort of; I think it is really "transformation" of element into null, skipping until end, and not properly synchronizing. I really should rewrite the backend, one of these days, but for that to happen would probably need one of 2 things to happen -- either finding XML to be higher priority than other formats (aside from json), or, find a way to maintain Jackson for living and not just as a hobby.
But I digress. :)

I think I can figure out a fix/work-around for this particular problem. It's just more difficult than it should be, because of complexity of backend implementation which at this point is patch-over-patch, transforming one stream of events into another with sort of minimal state keeping.

@cowtowncoder cowtowncoder added this to the 2.10.2 milestone Jan 5, 2020
@cowtowncoder cowtowncoder changed the title Jackson 2.10.x fails to deserialize xsi:nil when schema is http://www.w3.org/2001/XMLSchema-instance Jackson 2.10.x fails to deserialize xsi:nil with multiple child elements Jan 5, 2020
@henrik242
Copy link
Author

Thanks!

@cowtowncoder
Copy link
Member

2.10.2 now released, I hope things work as expected. Also, reports for other edge cases (if any) would be welcome.

@henrik242
Copy link
Author

henrik242 commented Oct 13, 2020

FasterXML/jackson-module-kotlin#396 might be related to this (jackson 2.12.0-rc1 regression)

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

No branches or pull requests

2 participants