geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject svn commit: r943414 - /geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/TemporaryClassLoader.java
Date Wed, 12 May 2010 08:54:41 GMT
Author: rwonly
Date: Wed May 12 08:54:41 2010
New Revision: 943414

URL: http://svn.apache.org/viewvc?rev=943414&view=rev
Log:
GERONIMO-4945 Unable to deploy ejb with custom annotation

Modified:
    geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/TemporaryClassLoader.java

Modified: geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/TemporaryClassLoader.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/TemporaryClassLoader.java?rev=943414&r1=943413&r2=943414&view=diff
==============================================================================
--- geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/TemporaryClassLoader.java
(original)
+++ geronimo/server/branches/2.2/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/classloader/TemporaryClassLoader.java
Wed May 12 08:54:41 2010
@@ -100,7 +100,7 @@ public class TemporaryClassLoader extend
        }
 
        // Annotation classes must be loaded by the normal classloader
-       if (isAnnotationClass(bytes)) {
+       if (isAnnotationClass(bytes)||isEnum(bytes)) {
            return super.loadClass(name, resolve);
        }
 
@@ -141,5 +141,27 @@ public class TemporaryClassLoader extend
        }
 
    }
+   
+    
+    /**
+     * Fast-parse the given class bytecode to determine if it is an
+     * enum class.
+     */
+    private static boolean isEnum(byte[] bytes) {
+        IsEnumVisitor isEnumVisitor = new IsEnumVisitor();
+        ClassReader classReader = new ClassReader(bytes);
+        classReader.accept(isEnumVisitor, ClassReader.SKIP_DEBUG);
+        return isEnumVisitor.isEnum;
+    }
+    
+    public static class IsEnumVisitor extends EmptyVisitor {
+        public boolean isEnum = false;
+
+        public void visit(int version, int access, String name, String signature, String
superName, String[] interfaces) {
+            isEnum = (access & Opcodes.ACC_ENUM) != 0;
+        }
+
+    }
+    
 }
 



Mime
View raw message