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

2.3.8 @XmlValue with @XmlJavaTypeAdapter causes NullPointerException #1711

Open
lulnope opened this issue May 18, 2023 · 3 comments
Open

2.3.8 @XmlValue with @XmlJavaTypeAdapter causes NullPointerException #1711

lulnope opened this issue May 18, 2023 · 3 comments

Comments

@lulnope
Copy link

lulnope commented May 18, 2023

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.
@laurentschoelens
Copy link
Contributor

Hi @lulnope :
This issue is not specific to 2.3.8
Same issue with 2.3.3

@laurentschoelens
Copy link
Contributor

Your XMLAdapter is not well defined.
By changing from extends XmlAdapter<Object, LocalDate> to extends XmlAdapter<String, LocalDate>, your code will work as expected.

@laurentschoelens
Copy link
Contributor

@lukasj : this issue can be closed I think

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