openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1800732 - in /openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy: AbstractProxyFactory.java InterceptorDecoratorProxyFactory.java NormalScopeProxyFactory.java SubclassProxyFactory.java
Date Tue, 04 Jul 2017 07:09:15 GMT
Author: rmannibucau
Date: Tue Jul  4 07:09:14 2017
New Revision: 1800732

URL: http://svn.apache.org/viewvc?rev=1800732&view=rev
Log:
OWB-1196 ensure we can proxy signed classes - backport from trunk in 1.7.x

Modified:
    openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java
    openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
    openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java
    openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/SubclassProxyFactory.java

Modified: openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java?rev=1800732&r1=1800731&r2=1800732&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java
(original)
+++ openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java
Tue Jul  4 07:09:14 2017
@@ -184,6 +184,13 @@ public abstract class AbstractProxyFacto
         throw new WebBeansException("Unable to detect a free proxy class name based on: "
+ proxyClassName);
     }
 
+    protected  <T> String getSignedClassProxyName(final Class<T> classToProxy)
+    {
+        // avoid java.lang.SecurityException: class's signer information
+        // does not match signer information of other classes in the same package
+        return "org.apache.webbeans.custom.signed." + classToProxy.getName();
+    }
+
     protected String fixPreservedPackages(String proxyClassName)
     {
         proxyClassName = fixPreservedPackage(proxyClassName, "java.");

Modified: openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java?rev=1800732&r1=1800731&r2=1800732&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
(original)
+++ openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
Tue Jul  4 07:09:14 2017
@@ -182,7 +182,9 @@ public class InterceptorDecoratorProxyFa
                                                       Method[] interceptedMethods, Method[]
nonInterceptedMethods)
             throws ProxyGenerationException
     {
-        String proxyClassName = getUnusedProxyClassName(classLoader, classToProxy.getName()
+ "$$OwbInterceptProxy");
+        String proxyClassName = getUnusedProxyClassName(
+                classLoader,
+                (classToProxy.getSigners() != null ? getSignedClassProxyName(classToProxy)
: classToProxy.getName()) + "$$OwbInterceptProxy");
 
 
         Class<T> clazz = createProxyClass(classLoader, proxyClassName, classToProxy,
interceptedMethods, nonInterceptedMethods);

Modified: openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java?rev=1800732&r1=1800731&r2=1800732&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java
(original)
+++ openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/NormalScopeProxyFactory.java
Tue Jul  4 07:09:14 2017
@@ -232,7 +232,9 @@ public class NormalScopeProxyFactory ext
     public <T> Class<T> createProxyClass(ClassLoader classLoader, Class<T>
classToProxy)
             throws ProxyGenerationException
     {
-        String proxyClassName = getUnusedProxyClassName(classLoader, classToProxy.getName()
+ "$$OwbNormalScopeProxy");
+        String proxyClassName = getUnusedProxyClassName(
+                classLoader,
+                (classToProxy.getSigners() != null ? getSignedClassProxyName(classToProxy)
: classToProxy.getName()) + "$$OwbNormalScopeProxy");
 
         Method[] nonInterceptedMethods;
         Method[] interceptedMethods = null;

Modified: openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/SubclassProxyFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/SubclassProxyFactory.java?rev=1800732&r1=1800731&r2=1800732&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/SubclassProxyFactory.java
(original)
+++ openwebbeans/branches/owb_1.7.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/SubclassProxyFactory.java
Tue Jul  4 07:09:14 2017
@@ -43,6 +43,8 @@ import javax.inject.Inject;
 public class SubclassProxyFactory extends AbstractProxyFactory
 {
 
+    private static final String SUB_CLASS_NAME_SUFFIX = "$$OwbSubClass";
+
     public SubclassProxyFactory(WebBeansContext webBeansContext)
     {
         super(webBeansContext);
@@ -92,7 +94,11 @@ public class SubclassProxyFactory extend
 
     private <T> String getSubClassName(Class<T> classToProxy)
     {
-        return fixPreservedPackages(classToProxy.getName() + "$$OwbSubClass");
+        if (classToProxy.getSigners() != null)
+        {
+            return getSignedClassProxyName(classToProxy) + SUB_CLASS_NAME_SUFFIX;
+        }
+        return fixPreservedPackages(classToProxy.getName() + SUB_CLASS_NAME_SUFFIX);
     }
 
     /**



Mime
View raw message