camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r546484 - /activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java
Date Tue, 12 Jun 2007 13:53:03 GMT
Author: jstrachan
Date: Tue Jun 12 06:53:02 2007
New Revision: 546484

URL: http://svn.apache.org/viewvc?view=rev&rev=546484
Log:
fixed possible NPE

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java?view=diff&rev=546484&r1=546483&r2=546484
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java
Tue Jun 12 06:53:02 2007
@@ -87,14 +87,19 @@
         if (className == null) {
             throw new IOException("Expected property is missing: " + propertyPrefix + "class");
         }
-        Class clazz;
-        try {
-            clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
+        Class clazz = null;
+        ClassLoader loader = Thread.currentThread().getContextClassLoader();
+        if (loader != null) {
+            try {
+                clazz = loader.loadClass(className);
+            }
+            catch (ClassNotFoundException e) {
+                // ignore
+            }
         }
-        catch (ClassNotFoundException e) {
+        if (clazz == null) {
             clazz = FactoryFinder.class.getClassLoader().loadClass(className);
         }
-
         return clazz;
     }
 



Mime
View raw message