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

Bug 343169

Summary: Dynamic JAXB: IndexOutOfBounds error generating Enums
Product: z_Archived Reporter: Rick Barkhouse <rick.barkhouse>
Component: EclipselinkAssignee: Rick Barkhouse <rick.barkhouse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch none

Description Rick Barkhouse CLA 2011-04-18 11:52:57 EDT
Dynamic Class generation fails for an enum if it contains exactly 6 enum values.

E.g.:

	<xs:simpleType name="compass-direction">
		<xs:restriction base="xs:string">
			<xs:enumeration value="NORTH" />
			<xs:enumeration value="SOUTH" />
			<xs:enumeration value="EAST" />
			<xs:enumeration value="WEST" />
			<xs:enumeration value="SWEST" />
                        <xs:enumeration value="NWEST" />
		</xs:restriction>
	</xs:simpleType>


Caused by: Exception [EclipseLink-50040] (Eclipse Persistence Services - 2.3.0.v20110415-r9234): org.eclipse.persistence.exceptions.JAXBException
Exception Description: Error creating DynamicJAXBContext.
Internal Exception: java.lang.ArrayIndexOutOfBoundsException: 6
        at org.eclipse.persistence.exceptions.JAXBException.errorCreatingDynamicJAXBContext(JAXBException.java:582)
        ... 35 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 6
        at org.eclipse.persistence.dynamic.DynamicClassWriter.createEnum(DynamicClassWriter.java:303)
        at org.eclipse.persistence.dynamic.DynamicClassWriter.writeClass(DynamicClassWriter.java:172)
        at org.eclipse.persistence.dynamic.DynamicClassLoader.findClass(DynamicClassLoader.java:210)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Comment 1 Rick Barkhouse CLA 2011-04-18 14:21:43 EDT
Created attachment 193514 [details]
Patch
Comment 2 Rick Barkhouse CLA 2011-04-18 14:28:21 EDT
Fixed, reviewed by bdoughan.

DynamicJAXBFromXSDTestCases.testXmlEnum() has been modified to have 6 enum values to ensure this case is tested.
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:08:16 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink