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/15 20:49:52 UTC

svn commit: r1503407 - in /cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension: Extension.java ExtensionManagerImpl.java

Author: dkulp
Date: Mon Jul 15 18:49:52 2013
New Revision: 1503407

URL: http://svn.apache.org/r1503407
Log:
Merged revisions 1497523 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes

........
  r1497523 | dkulp | 2013-06-27 15:42:00 -0400 (Thu, 27 Jun 2013) | 18 lines

  Merged revisions 1497515 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

  ........
    r1497515 | dkulp | 2013-06-27 15:28:41 -0400 (Thu, 27 Jun 2013) | 10 lines

    Merged revisions 1497481 via  git cherry-pick from
    https://svn.apache.org/repos/asf/cxf/trunk

    ........
      r1497481 | dkulp | 2013-06-27 14:04:21 -0400 (Thu, 27 Jun 2013) | 2 lines

      [CXF-5099] Fix problem of optional extensions not being truely optional

    ........

  ........

........

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

Modified: cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java?rev=1503407&r1=1503406&r2=1503407&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java (original)
+++ cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/Extension.java Mon Jul 15 18:49:52 2013
@@ -205,19 +205,18 @@ public class Extension {
             }
             obj = cls.getConstructor().newInstance();
         } catch (ExtensionException ex) {
-            throw ex;
-        } catch (IllegalAccessException ex) {
-            throw new ExtensionException(new Message("PROBLEM_CREATING_EXTENSION_CLASS", LOG, cls.getName()), ex);
-        } catch (InstantiationException ex) {
-            throw new ExtensionException(new Message("PROBLEM_CREATING_EXTENSION_CLASS", LOG, cls.getName()), ex);
-        } catch (IllegalArgumentException e) {
-            throw new ExtensionException(new Message("PROBLEM_CREATING_EXTENSION_CLASS", LOG, cls.getName()), e);
-        } catch (SecurityException e) {
-            throw new ExtensionException(new Message("PROBLEM_CREATING_EXTENSION_CLASS", LOG, cls.getName()), e);
+            notFound = true;
+            if (!optional) {
+                throw ex;
+            }
         } catch (InvocationTargetException ex) {
-            throw new ExtensionException(new Message("PROBLEM_CREATING_EXTENSION_CLASS", LOG, cls.getName()), 
-                                         ex.getCause());
+            notFound = true;
+            if (!optional) {
+                throw new ExtensionException(new Message("PROBLEM_CREATING_EXTENSION_CLASS", LOG, cls.getName()), 
+                                             ex.getCause());
+            }
         } catch (NoSuchMethodException ex) {
+            notFound = true;
             List<Object> a = new ArrayList<Object>();
             if (b != null) {
                 a.add(b);
@@ -225,8 +224,15 @@ public class Extension {
             if (args != null) {
                 a.add(args);
             }
-            throw new ExtensionException(new Message("PROBLEM_FINDING_CONSTRUCTOR", LOG,
-                                                     cls.getName(), a), ex);
+            if (!optional) {
+                throw new ExtensionException(new Message("PROBLEM_FINDING_CONSTRUCTOR", LOG,
+                                                         cls.getName(), a), ex);
+            }
+        } catch (Throwable e) {
+            notFound = true;
+            if (!optional) {
+                throw new ExtensionException(new Message("PROBLEM_CREATING_EXTENSION_CLASS", LOG, cls.getName()), e);
+            }
         }
         return obj;
     }

Modified: cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java?rev=1503407&r1=1503406&r2=1503407&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java (original)
+++ cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/extension/ExtensionManagerImpl.java Mon Jul 15 18:49:52 2013
@@ -189,6 +189,9 @@ public class ExtensionManagerImpl implem
         }
  
         Object obj = e.load(loader, bus);
+        if (obj == null) {
+            return;
+        }
         
         Configurer configurer = (Configurer)(activated.get(Configurer.class));
         if (null != configurer) {