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

Bug 318922

Summary: Enum metadata processing should not load classes
Product: z_Archived Reporter: Shaun Smith <shaun.smith>
Component: EclipselinkAssignee: Shaun Smith <shaun.smith>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
EnumeratedMetadata.java patch
none
EnumTypeConverter.java patch
none
EnumTypeConverter.java patch
none
EnumTypeConverter.java.patch
none
EnumeratedMetadata.java patch
none
EnumTypeConverter.java.patch none

Description Shaun Smith CLA 2010-07-05 12:57:59 EDT
Created attachment 173457 [details]
EnumeratedMetadata.java patch

org.eclipse.persistence.internal.jpa.metadata.converters.EnumeratedMetadata.process creates an EnumTypeConverter and calls getJavaClass(referenceClass) which attempts to load the actual Java class pointed at by the MetadataClass referenceClass.  In Gemini, metadata is processed before a classloader is available and so this attempt to class load fails and persistence unit deployment fails.

The solution is to pass the name of the class to the EnumTypeConverter and let it lazily initialize the actual Java class--post metadata processing.

Patches for EnumTypeConverter and EnumeratedMetadata attached.
Comment 1 Shaun Smith CLA 2010-07-05 12:58:26 EDT
Created attachment 173458 [details]
EnumTypeConverter.java patch
Comment 2 Shaun Smith CLA 2010-07-07 11:42:58 EDT
Created attachment 173669 [details]
EnumTypeConverter.java patch
Comment 3 Shaun Smith CLA 2010-07-07 11:50:10 EDT
Created attachment 173670 [details]
EnumTypeConverter.java.patch
Comment 4 Shaun Smith CLA 2010-07-07 12:24:00 EDT
Created attachment 173677 [details]
EnumeratedMetadata.java patch

Revised patch using new EnumTypeConverter constructor that takes a boolean useOrdinalValues.
Comment 5 Shaun Smith CLA 2010-07-07 12:27:04 EDT
Created attachment 173678 [details]
EnumTypeConverter.java.patch

Adds new constructor that supports specification of enum class *name* and whether to use ordinal values--used by EnumeratedMetadata.process(..)
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:09:54 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink