Closed mbradshawUtah closed 3 weeks ago
If I just do MEMBER.class and have 1 household member then It deserializes fine. If I do the sectionB and the sectionb class I get the same error. Something with List causing an issue?
Added a label noting that we'd need an actual manageable test case -- definitions and output above is way too big to help with reproduction, unfortunately.
Added a label noting that we'd need an actual manageable test case -- definitions and output above is way too big to help with reproduction, unfortunately.
I have attached 4 smaller files for the test. What is happening is that Reading HOUSEHOLD_MEMBER by itself works and loads correctly into the java object.
Doesn't matter if there is 1 household member in section b or multiple household members in section b both will result in the same error. Same thing happens when section b is in the Applicaiton tags the surrounding object application full type that also fails. I expect all 3 tests to return yes1.
Ok this is more useful (thank you!), but what is eventually needed is a unit test to reproduce the problem.
Still maybe someone has time to look into this and smaller files sound useful. I don't think I will have time to look into this on short term but others might.
Oh: forgot to mention that it may make sense to try this with 2.18.0-SNAPSHOT
versions. Constructor detection has been rewritten in 2.18 branch and that might relevant, wrt exception message (if this is due to incorrect detection of Constructor to use).
So apparently the issue is that HOUSEHOLD_MEMBER List doesn't use a wrapper so specifying that fixes this issue.
Not sure why jaxb is generating the class like that.
@JacksonXmlElementWrapper(useWrapping=false)
JacksonXmlModule xmlModule = new JacksonXmlModule(); xmlModule.setDefaultUseWrapper(false); XmlMapper xmlMapper = new XmlMapper(xmlModule);
This is resolved once I used this code above. Apparently since Jaxb uses lists we have to disable the defaultusewrapper.
JAXB defaults are indeed different: if no annotations/configuration is changed, JAXB defaults to "unwrapped" Lists. Jackson defaults to wrapped Lists and requires configuration or annotations to disable it.
JacksonXmlUtil.txt APPLICATION_FULL_TYPE.txt SECTION_B_TYPE.txt MEMBER.txt
Looks similar to this issue, but I am still having this issue even though I am using 2.17.1 https://github.com/FasterXML/jackson-dataformat-xml/issues/646
I am expecting Yes1 for all 3 tests.
ERROR:
CODE: