cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1102193 - /cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
Date Thu, 12 May 2011 07:46:43 GMT
Author: ningjiang
Date: Thu May 12 07:46:43 2011
New Revision: 1102193

URL: http://svn.apache.org/viewvc?rev=1102193&view=rev
Log:
CXF-3512 CXF extension using it's classloader as a fallback to load the class

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java?rev=1102193&r1=1102192&r2=1102193&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java Thu May 12
07:46:43 2011
@@ -26,9 +26,8 @@ import java.util.Collection;
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.util.StringUtils;
 
-
 public class Extension {
-
+   
     private String className;
     private Class<?> clazz;
     private String interfaceName;
@@ -69,7 +68,12 @@ public class Extension {
             try {
                 clazz = cl.loadClass(className);
             } catch (ClassNotFoundException ex) {
-                throw new ExtensionException(ex);
+                try {
+                    // using the extension classloader as a fallback
+                    clazz = this.getClass().getClassLoader().loadClass(className);
+                } catch (ClassNotFoundException nex) {
+                    throw new ExtensionException(nex);
+                }
             }
         }
         return clazz;
@@ -131,7 +135,12 @@ public class Extension {
         try {
             cls = cl.loadClass(interfaceName);
         } catch (ClassNotFoundException ex) {
-            throw new ExtensionException(ex);
+            try {
+                // using the extension classloader as a fallback
+                cls = this.getClass().getClassLoader().loadClass(interfaceName);
+            } catch (ClassNotFoundException nex) {
+                throw new ExtensionException(nex);
+            }
         }
         return cls;
     }



Mime
View raw message