deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject deltaspike git commit: DELTASPIKE-870 Partial Bean with signed jar trouble
Date Wed, 08 Apr 2015 17:58:52 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master cb62677ff -> a40c71da6


DELTASPIKE-870 Partial Bean with signed jar trouble

Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/a40c71da
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/a40c71da
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/a40c71da

Branch: refs/heads/master
Commit: a40c71da60080be0016e70d3bff54aee9789977e
Parents: cb62677
Author: Thomas Andraschko <tandraschko@apache.org>
Authored: Wed Apr 8 19:58:43 2015 +0200
Committer: Thomas Andraschko <tandraschko@apache.org>
Committed: Wed Apr 8 19:58:43 2015 +0200

----------------------------------------------------------------------
 .../core/util/proxy/AsmProxyClassGenerator.java     | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/a40c71da/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/proxy/AsmProxyClassGenerator.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/proxy/AsmProxyClassGenerator.java
b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/proxy/AsmProxyClassGenerator.java
index e1f8394..e7942af 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/proxy/AsmProxyClassGenerator.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/proxy/AsmProxyClassGenerator.java
@@ -23,6 +23,7 @@ import org.apache.deltaspike.core.util.proxy.invocation.DelegateManualInvocation
 import java.lang.annotation.Annotation;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.UndeclaredThrowableException;
+import java.security.ProtectionDomain;
 import java.util.ArrayList;
 import java.util.Arrays;
 import javax.enterprise.inject.Typed;
@@ -60,8 +61,9 @@ public abstract class AsmProxyClassGenerator
 
         byte[] proxyBytes = generateProxyClassBytes(targetClass, invocationHandlerClass,
                 classFileName, superAccessorMethodSuffix, additionalInterfaces, delegateMethods,
interceptMethods);
-        
-        Class<T> proxyClass = (Class<T>) loadClass(classLoader, proxyName, proxyBytes);
+
+        Class<T> proxyClass = (Class<T>) loadClass(classLoader, proxyName, proxyBytes,
+                targetClass.getProtectionDomain());
 
         return proxyClass;
     }
@@ -95,7 +97,7 @@ public abstract class AsmProxyClassGenerator
                 interfaces[(interfaces.length - 1) + i] = Type.getInternalName(additionalInterfaces[i]);
             }
         }
-        
+
         Type superType = Type.getType(superClass);
         Type proxyType = Type.getObjectType(proxyName);
         Type invocationHandlerType = Type.getType(invocationHandlerClass);
@@ -429,13 +431,14 @@ public abstract class AsmProxyClassGenerator
      *
      * @return Class<?>
      */
-    private static Class<?> loadClass(ClassLoader loader, String className, byte[]
b)
+    private static Class<?> loadClass(ClassLoader loader, String className, byte[]
b,
+            ProtectionDomain protectionDomain)
     {
         // override classDefine (as it is protected) and define the class.
         try
         {
             java.lang.reflect.Method method = ClassLoader.class.getDeclaredMethod(
-                    "defineClass", String.class, byte[].class, int.class, int.class);
+                    "defineClass", String.class, byte[].class, int.class, int.class, ProtectionDomain.class);
 
             // protected method invocation
             boolean accessible = method.isAccessible();
@@ -445,7 +448,8 @@ public abstract class AsmProxyClassGenerator
             }
             try
             {
-                return (Class<?>) method.invoke(loader, className, b, Integer.valueOf(0),
Integer.valueOf(b.length));
+                return (Class<?>) method.invoke(loader, className, b, Integer.valueOf(0),
Integer.valueOf(b.length),
+                        protectionDomain);
             }
             finally
             {


Mime
View raw message