Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318922 - Enum metadata processing should not load classes
Summary: Enum metadata processing should not load classes
Status: CLOSED 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: Shaun Smith CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-05 12:57 EDT by Shaun Smith CLA
Modified: 2022-06-09 10:09 EDT (History)
0 users

See Also:


Attachments
EnumeratedMetadata.java patch (589 bytes, patch)
2010-07-05 12:57 EDT, Shaun Smith CLA
no flags Details | Diff
EnumTypeConverter.java patch (1.94 KB, patch)
2010-07-05 12:58 EDT, Shaun Smith CLA
no flags Details | Diff
EnumTypeConverter.java patch (1.35 KB, patch)
2010-07-07 11:42 EDT, Shaun Smith CLA
no flags Details | Diff
EnumTypeConverter.java.patch (1.29 KB, patch)
2010-07-07 11:50 EDT, Shaun Smith CLA
no flags Details | Diff
EnumeratedMetadata.java patch (585 bytes, patch)
2010-07-07 12:24 EDT, Shaun Smith CLA
no flags Details | Diff
EnumTypeConverter.java.patch (1.89 KB, patch)
2010-07-07 12:27 EDT, Shaun Smith CLA
no flags Details | Diff

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