You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2007/06/21 16:27:25 UTC

svn commit: r549493 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java

Author: rickhall
Date: Thu Jun 21 07:27:24 2007
New Revision: 549493

URL: http://svn.apache.org/viewvc?view=rev&rev=549493
Log:
Modified our hack to guess when boot delegation is necessary to check for
and ignore the Proxy class on the stack. Also now when checking to see if
the class loader of the class on the call stack is a bundle class loader,
it also walks up the class loader hierarchy just in case the class loader
is a custom class loader from a bundle.

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java?view=diff&rev=549493&r1=549492&r2=549493
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java Thu Jun 21 07:27:24 2007
@@ -19,6 +19,7 @@
 package org.apache.felix.framework.searchpolicy;
 
 import java.io.IOException;
+import java.lang.reflect.Proxy;
 import java.net.URL;
 import java.security.ProtectionDomain;
 import java.util.*;
@@ -481,12 +482,23 @@
             }
             else if ((this.getClass().getClassLoader() != classes[i].getClassLoader())
                 && !ClassLoader.class.isAssignableFrom(classes[i])
-                && !Class.class.equals(classes[i]))
+                && !Class.class.equals(classes[i])
+                && !Proxy.class.equals(classes[i]))
             {
-                // If the instigating class was not from a bundle, then
-                // delegate to the parent class loader. Otherwise, break
-                // out of loop and return null.
-                if (!ContentClassLoader.class.isInstance(classes[i].getClassLoader()))
+                // If there are no bundles providing exports for this
+                // package and if the instigating class was not from a
+                // bundle, then delegate to the parent class loader.
+                // Otherwise, break out of loop and return null.
+                boolean delegate = true;
+                for (ClassLoader cl = classes[i].getClassLoader(); cl != null; cl = cl.getClass().getClassLoader())
+                {
+                    if (ContentClassLoader.class.isInstance(cl))
+                    {
+                        delegate = false;
+                        break;
+                    }
+                }
+                if (delegate)
                 {
                     return this.getClass().getClassLoader().loadClass(name);
                 }