chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1453422 - /chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/ClassLoaderUtil.java
Date Wed, 06 Mar 2013 16:55:23 GMT
Author: fmui
Date: Wed Mar  6 16:55:22 2013
New Revision: 1453422

URL: http://svn.apache.org/r1453422
Log:
more robust class loading

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/ClassLoaderUtil.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/ClassLoaderUtil.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/ClassLoaderUtil.java?rev=1453422&r1=1453421&r2=1453422&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/ClassLoaderUtil.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/ClassLoaderUtil.java
Wed Mar  6 16:55:22 2013
@@ -24,7 +24,16 @@ public class ClassLoaderUtil {
      * Loads a class. If the context class loader is set, it is used.
      */
     public static Class<?> loadClass(String className) throws ClassNotFoundException
{
-        return loadClass(className, Thread.currentThread().getContextClassLoader());
+        ClassLoader ccl = Thread.currentThread().getContextClassLoader();
+        if (ccl == null) {
+            return loadClass(className, null);
+        }
+
+        try {
+            return loadClass(className, ccl);
+        } catch (ClassNotFoundException cnf) {
+            return loadClass(className, null);
+        }
     }
 
     /**



Mime
View raw message