You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by dw...@apache.org on 2010/03/08 19:30:43 UTC

svn commit: r920437 - /openjpa/branches/1.3.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/TemporaryClassLoader.java

Author: dwoods
Date: Mon Mar  8 18:30:43 2010
New Revision: 920437

URL: http://svn.apache.org/viewvc?rev=920437&view=rev
Log:
OPENJPA-1121 Enums cause a ClassNotFoundException in the MappingTool.  Merged in from trunk.  Original patch from Frank Schwarz.

Modified:
    openjpa/branches/1.3.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/TemporaryClassLoader.java

Modified: openjpa/branches/1.3.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/TemporaryClassLoader.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/TemporaryClassLoader.java?rev=920437&r1=920436&r2=920437&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/TemporaryClassLoader.java (original)
+++ openjpa/branches/1.3.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/TemporaryClassLoader.java Mon Mar  8 18:30:43 2010
@@ -73,9 +73,15 @@
             // To avoid classloader issues with the JVM (Sun and IBM), we
             // will not load Enums via the TemporaryClassLoader either.
             // Reference JIRA Issue OPENJPA-646 for more information.
-            if (isAnnotation(classBytes) || isEnum(classBytes))
-                return Class.forName(name, resolve, getClass().
-                    getClassLoader());
+            if (isAnnotation(classBytes) || isEnum(classBytes)) {
+                try {
+                    Class<?> frameworkClass = Class.forName(name, resolve,
+                            getClass().getClassLoader());
+                    return frameworkClass;
+                } catch (ClassNotFoundException e) {
+                    // OPENJPA-1121 continue, as it must be a user-defined class
+                }
+            }
 
             try {
                 return defineClass(name, classBytes, 0, classBytes.length);