commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1090196 - /commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java
Date Fri, 08 Apr 2011 10:52:57 GMT
Author: simonetripodi
Date: Fri Apr  8 10:52:56 2011
New Revision: 1090196

URL: http://svn.apache.org/viewvc?rev=1090196&view=rev
Log:
proposal for fix DISCOVERY-6

Modified:
    commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java

Modified: commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java
URL: http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java?rev=1090196&r1=1090195&r2=1090196&view=diff
==============================================================================
--- commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java
(original)
+++ commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/resource/classes/DiscoverClasses.java
Fri Apr  8 10:52:56 2011
@@ -96,7 +96,18 @@ public class DiscoverClasses<T> extends 
             private ResourceClass<T> getNextClass() {
                 while (idx < getClassLoaders().size()) {
                     ClassLoader loader = getClassLoaders().get(idx++);
-                    URL url = loader.getResource(resourceName);
+
+                    URL url = null;
+                    try {
+                        url = loader.getResource(resourceName);
+                    } catch (UnsupportedOperationException e) {
+                        try {
+                            url = loader.loadClass(className).getProtectionDomain().getCodeSource().getLocation();
+                        } catch (Exception le) {
+                            // keep url null
+                        }
+                    }
+
                     if (url != null) {
                         if (!history.contains(url)) {
                             history.add(url);



Mime
View raw message