Clean up source resource URL connection handling. (FELIX-2950)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1153652 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java b/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
index cdf8e19..aa52034 100644
--- a/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
+++ b/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
@@ -28,6 +28,7 @@
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 @@
{
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);