OPENJPA-1121: Load user-defined Enums.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@826959 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2009-10-20 05:40:40 +00:00
parent afb95a595f
commit 59c81b98aa
1 changed files with 9 additions and 3 deletions

View File

@ -73,9 +73,15 @@ public class TemporaryClassLoader extends ClassLoader {
// 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) {
// continue, as it must be a user-defined class
}
}
try {
return defineClass(name, classBytes, 0, classBytes.length);