abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1058884 - /abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Discover.java
Date Fri, 14 Jan 2011 08:09:42 GMT
Author: antelder
Date: Fri Jan 14 08:09:42 2011
New Revision: 1058884

URL: http://svn.apache.org/viewvc?rev=1058884&view=rev
Log:
ABDERA-279: Apply patch from Antoine Toulme to fix Faulty classloading - unreachable code

Modified:
    abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Discover.java

Modified: abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Discover.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Discover.java?rev=1058884&r1=1058883&r2=1058884&view=diff
==============================================================================
--- abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Discover.java (original)
+++ abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Discover.java Fri Jan 14 08:09:42
2011
@@ -157,9 +157,15 @@ public final class Discover {
         Class<T> c = null;
         try {
             c = (Class<T>)loader.loadClass(spec);
-            c = (Class<T>)(c != null ? c : getClass(Discover.class.getClassLoader(),
spec));
         } catch (ClassNotFoundException e) {
-            throw new RuntimeException(e);
+            try {
+                // try loading the class from the Discover class loader
+                // if the loader failed.
+                c = (Class<T>)Discover.class.getClassLoader().loadClass(spec);
+            } catch (ClassNotFoundException e1) {
+                // throw the original exception
+                throw new RuntimeException(e);
+            }
         }
         return c;
     }



Mime
View raw message