You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2013/07/22 19:52:14 UTC

svn commit: r1505746 - /cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java

Author: dkulp
Date: Mon Jul 22 17:52:14 2013
New Revision: 1505746

URL: http://svn.apache.org/r1505746
Log:
Try and throw the most useful of the exceptions

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=1505746&r1=1505745&r2=1505746&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 Mon Jul 22 17:52:14 2013
@@ -157,11 +157,14 @@ public class Extension {
     }
     
     protected Class<?> tryClass(String name, ClassLoader cl) {
+        Throwable origEx = null;
         if (classloader != null) {
             try {
                 return classloader.loadClass(name);
             } catch (Throwable nex) {
                 //ignore, fall into the stuff below
+                //save the exception though as this is likely the important one
+                origEx = nex;
             }
         }                
         try {
@@ -173,7 +176,10 @@ public class Extension {
             } catch (Throwable nex) {
                 notFound = true;
                 if (!optional) {
-                    throw new ExtensionException(new Message("PROBLEM_LOADING_EXTENSION_CLASS", LOG, name), nex);
+                    if (origEx != null) {
+                        ex = origEx;
+                    }
+                    throw new ExtensionException(new Message("PROBLEM_LOADING_EXTENSION_CLASS", LOG, name), ex);
                 }
             }
         }