Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343169 - Dynamic JAXB: IndexOutOfBounds error generating Enums
Summary: Dynamic JAXB: IndexOutOfBounds error generating Enums
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Rick Barkhouse CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-18 11:52 EDT by Rick Barkhouse CLA
Modified: 2022-06-09 10:08 EDT (History)
0 users

See Also:


Attachments
Patch (2.40 KB, patch)
2011-04-18 14:21 EDT, Rick Barkhouse CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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