| Summary: | XmlJavaTypeAdapter requires specified class extend XmlAdapter directly | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Paul Fullbright <paul.fullbright> | ||||||||||||
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> | ||||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||||
| Severity: | normal | ||||||||||||||
| Priority: | P3 | CC: | blaise.doughan, martin.grebac, rick.barkhouse | ||||||||||||
| Version: | unspecified | ||||||||||||||
| Target Milestone: | --- | ||||||||||||||
| Hardware: | PC | ||||||||||||||
| OS: | Windows 7 | ||||||||||||||
| Whiteboard: | |||||||||||||||
| Attachments: |
|
||||||||||||||
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 |
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.)