You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2011/08/03 22:34:51 UTC

svn commit: r1153652 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java

Author: rickhall
Date: Wed Aug  3 20:34:50 2011
New Revision: 1153652

URL: http://svn.apache.org/viewvc?rev=1153652&view=rev
Log:
Clean up source resource URL connection handling. (FELIX-2950)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java?rev=1153652&r1=1153651&r2=1153652&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java Wed Aug  3 20:34:50 2011
@@ -28,6 +28,7 @@ import org.apache.felix.framework.util.U
 import org.osgi.framework.Bundle;
 import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.framework.wiring.BundleRevisions;
+import org.osgi.framework.wiring.BundleWiring;
 
 class URLHandlersBundleURLConnection extends URLConnection
 {
@@ -124,12 +125,12 @@ class URLHandlersBundleURLConnection ext
         {
             m_classPathIdx = 0;
         }
-// TODO: OSGi R4.3 - This is messed up. We need to fix resource lookup.
         if (!((BundleRevisionImpl) m_targetRevision)
             .hasInputStream(m_classPathIdx, url.getPath()))
         {
-            URL newurl = ((BundleWiringImpl)
-                m_targetRevision.getWiring()).getResourceByDelegation(url.getPath());
+            BundleWiring wiring = m_targetRevision.getWiring();
+            ClassLoader cl = (wiring != null) ? wiring.getClassLoader() : null;
+            URL newurl = (cl != null) ? cl.getResource(url.getPath()) : null;
             if (newurl == null)
             {
                 throw new IOException("Resource does not exist: " + url);