Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 343424

Summary: Error handing xml-binding level overrides if class isn't explicitly given to JAXBContextFactory
Product: z_Archived Reporter: Denise Smith <denise.mahar>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: blaise.doughan
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Proposed changes and test none

Description Denise Smith CLA 2011-04-20 11:00:34 EDT
Assume the following bindings file

<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm">
    <xml-schema-types>
        <xml-schema-type name="int" type="java.math.BigDecimal" />
    </xml-schema-types>
    <xml-java-type-adapters>
        <xml-java-type-adapter value="testing.MyCalendarAdapter" type="testing.MyCalendar"/>
    </xml-java-type-adapters>
</xml-bindings>

If Employee has an Address and both Employee and Address should make use of the xml-schema-type and xml-java-type-adapter specified if we create the context like below then everything works fine

Class[] classes = new Class[]{Employee.class, Address.class};
JAXBContext ctx = JAXBContextFactory.createContext(classes, getProperties());

If the context is created without Address set then the xml-schema-type and xml-java-type-adapter are not used with it.  ie:
Class[] classes = new Class[]{Employee.class};
JAXBContext ctx = JAXBContextFactory.createContext(classes, getProperties());
Comment 1 Denise Smith CLA 2011-05-04 09:22:50 EDT
Created attachment 194711 [details]
Proposed changes and test
Comment 2 Denise Smith CLA 2011-05-04 14:58:47 EDT
Modifications to store the package level adapters during processing so they can be accessed later when processing the extra types that weren't part of the original classes array.
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:33:35 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink