geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r344848 - /geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicProxyManager.java
Date Wed, 16 Nov 2005 02:32:33 GMT
Author: ammulder
Date: Tue Nov 15 18:32:31 2005
New Revision: 344848

URL: http://svn.apache.org/viewcvs?rev=344848&view=rev
Log:
Pick the best ClassLoader for the provided set of interfaces
  (Fixes GERONIMO-1064)

Modified:
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicProxyManager.java

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicProxyManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicProxyManager.java?rev=344848&r1=344847&r2=344848&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicProxyManager.java
(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicProxyManager.java
Tue Nov 15 18:32:31 2005
@@ -207,6 +207,24 @@
             } else if(type.length == 1) { // Unlikely (as a result of GeronimoManagedBean)
                 enhancer.setSuperclass(type[0]);
             } else {
+                ClassLoader best = null;
+                outer:
+                for (int i = 0; i < type.length; i++) {
+                    ClassLoader test = type[i].getClassLoader();
+                    for (int j = 0; j < type.length; j++) {
+                        String className = type[j].getName();
+                        try {
+                            test.loadClass(className);
+                        } catch (ClassNotFoundException e) {
+                            continue outer;
+                        }
+                    }
+                    best = test;
+                    break;
+                }
+                if(best != null) {
+                    enhancer.setClassLoader(best);
+                }
                 if(type[0].isInterface()) {
                     enhancer.setSuperclass(Object.class);
                     enhancer.setInterfaces(type);



Mime
View raw message