jaxb-ri
jaxb-ri copied to clipboard
2.3.8 @XmlValue with @XmlJavaTypeAdapter causes NullPointerException
Hi, i've stumbled into issues with marshalling/unmarshalling java types based on xsd complex type derived from a simple type by addition of an attribute. The issue occurs only if i put @XmlJavaTypeAdapter on value
field. Following is a link to my repository where i've uploaded 2 test cases for the issue in a form of maven project.
https://bitbucket.org/LuLNope/xmlvalue_adapter_test_case/src/master/
In the repository you can find 4 classes wih main
method:
- Case1WithAdapter - executing this class will result in NPE at com.sun.xml.bind.v2.runtime.FilterTransducer.useNamespace(FilterTransducer.java:37)
- Case1MainNoAdapter - this is the exact same case as previous class without any adapter used. Executing this main does not produce any errors.
- Case2MainWithAdapter - executing this class will result in NPE at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor.get(TransducedAccessor.java:136)
- Case2MainNoAdapter - this is the exact same case as previous class without any adapter used. Executing this main does not produce any errors.
Hi @lulnope : This issue is not specific to 2.3.8 Same issue with 2.3.3
Your XMLAdapter is not well defined.
By changing from extends XmlAdapter<Object, LocalDate>
to extends XmlAdapter<String, LocalDate>
, your code will work as expected.
@lukasj : this issue can be closed I think