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 20:17:52 UTC

svn commit: r1505758 - /cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java

Author: dkulp
Date: Mon Jul 22 18:17:51 2013
New Revision: 1505758

URL: http://svn.apache.org/r1505758
Log:
Merged revisions 1505746 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1505746 | dkulp | 2013-07-22 13:52:14 -0400 (Mon, 22 Jul 2013) | 2 lines

  Try and throw the most useful of the exceptions

........

Modified:
    cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java

Modified: cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java?rev=1505758&r1=1505757&r2=1505758&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java (original)
+++ cxf/branches/2.7.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java Mon Jul 22 18:17:51 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);
                 }
             }
         }