| Summary: | Problem with XmlElementRef and Inheritance | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Blaise Doughan <blaise.doughan> | ||||||||||||||||||
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> | ||||||||||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||||||||||
| Severity: | normal | ||||||||||||||||||||
| Priority: | P3 | CC: | eclipselink.oxm-inbox | ||||||||||||||||||
| Version: | unspecified | ||||||||||||||||||||
| Target Milestone: | --- | ||||||||||||||||||||
| Hardware: | PC | ||||||||||||||||||||
| OS: | Windows XP | ||||||||||||||||||||
| Whiteboard: | |||||||||||||||||||||
| Attachments: |
|
||||||||||||||||||||
Created attachment 180972 [details]
MOXy - Fix
Created attachment 180997 [details]
MOXy - Test Cases
Created attachment 180998 [details]
MOXy - Test Cases
Created attachment 180999 [details]
MOXy - Fix
Created attachment 181678 [details]
MOXy - Fix
Created attachment 181751 [details]
MOXy - Test Cases
Created attachment 181752 [details]
MOXy - Fix
Fix checked into trunk at rev: 8412 Code reviewed by: Matt MacIvor Summary: Instead of just checking for the element name corresponding to the property type, we now check for the element names of the property type and all subclasses. Fixed as per above comments. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
Created attachment 180899 [details] Example code demonstrating the problem With the attached example the following exception is thrown: Exception in thread "main" javax.xml.bind.JAXBException: Exception Description: Invalid XmlElementRef on property contactInfo on class blog.choice.Customer. Referenced Element not declared - with linked exception: [Exception [EclipseLink-50006] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.JAXBException Exception Description: Invalid XmlElementRef on property contactInfo on class blog.choice.Customer. Referenced Element not declared] at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:247) at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:207) at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:104) at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:94) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:201) at javax.xml.bind.ContextFinder.find(ContextFinder.java:330) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:618) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:565) at blog.choice.Demo.main(Demo.java:17) Caused by: Exception [EclipseLink-50006] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.JAXBException Exception Description: Invalid XmlElementRef on property contactInfo on class blog.choice.Customer. Referenced Element not declared at org.eclipse.persistence.exceptions.JAXBException.invalidElementRef(JAXBException.java:133) at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processReferenceProperty(AnnotationsProcessor.java:1601) at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.finalizeProperties(AnnotationsProcessor.java:602) at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processClassesAndProperties(AnnotationsProcessor.java:177) at org.eclipse.persistence.jaxb.compiler.Generator.<init>(Generator.java:143) at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:244) ... 12 more Instead the following XML document should be produced: <customer> <name>Jane Doe</name> <address> <city>Any Town</city> <street>1 A Street</street> </address> </customer>