Community
Participate
Working Groups
example: @XmlRootElement @XmlType @XmlAccessorType(XmlAccessType.FIELD) public class Root { @XmlJavaTypeAdapter(FooAdapter.class) protected Foo foo; } public class Foo {} @XmlAccessorType(XmlAccessType.FIELD) public class Bar { protected String bar = "baz"; } public class FooAdapter extends SuperFooAdapter {} public class SuperFooAdapter extends XmlAdapter<Bar, Foo> { @Override public Foo unmarshal(Bar v) throws Exception { return new Foo(); } @Override public Bar marshal(Foo v) throws Exception { return new Bar(); } } This will marshal model like: <root> <foo>adapt.Bar@1309025</foo> </root> whereas RI: will marshal like: <root> <foo> <bar>baz</bar> </foo> </root> (Also, debugging reveals that SuperFooAdapter is not queried for marshal methods.)
Created attachment 211895 [details] Test Case
It looks like this has already been fixed in another 2.3 transaction. I have confirmed that the adapter superclass is hit during marshal, and that the output is as expected, not a toString(). Added a test case to guard against a regression.
The problem occurs if the JAXBContext is created with only the Root class. Class[] classes = new Class[] {Root.class};
Created attachment 216219 [details] Patch - code changes - 2.5
Created attachment 216220 [details] Patch - test changes - 2.5
Created attachment 216224 [details] Patch - code changes - 2.5
*** Bug 373106 has been marked as a duplicate of this bug. ***
Fixed and checked into 2.4, rev. 11492
Checked into 2.5, rev. 11494
Created attachment 216300 [details] Patch - test and code changes - 2.3
Fixed and checked into 2.3.3, rev. 11501
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink