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 2006/02/06 09:50:13 UTC

svn commit: r375223 - /incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java

Author: rickhall
Date: Mon Feb  6 00:50:11 2006
New Revision: 375223

URL: http://svn.apache.org/viewcvs?rev=375223&view=rev
Log:
Modified to return a URL representing the "root" of the bundle JAR file
when Bundle.getEntry("/") is invoked.

Modified:
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java?rev=375223&r1=375222&r2=375223&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java Mon Feb  6 00:50:11 2006
@@ -114,6 +114,7 @@
     public URL getResource(String name)
     {
         URL url = null;
+
         // Remove leading slash, if present.
         if (name.startsWith("/"))
         {
@@ -165,19 +166,29 @@
     {
         URL url = null;
 
-        // Remove leading slash, if present.
-        if (name.startsWith("/"))
+        // Check for the special case of "/", which represents
+        // the root of the bundle according to the spec.
+        if (name.equals("/"))
         {
-            name = name.substring(1);
+            url = getURLPolicy().createURL("0/");
         }
 
-        // Check the module content.
-        if (getContent().hasEntry(name))
+        if (url == null)
         {
-            // Module content URLs start with 0, whereas module
-            // class path URLs start with the index into the class
-            // path + 1.
-            url = getURLPolicy().createURL("0/" + name);
+            // Remove leading slash, if present.
+            if (name.startsWith("/"))
+            {
+                name = name.substring(1);
+            }
+    
+            // Check the module content.
+            if (getContent().hasEntry(name))
+            {
+                // Module content URLs start with 0, whereas module
+                // class path URLs start with the index into the class
+                // path + 1.
+                url = getURLPolicy().createURL("0/" + name);
+            }
         }
 
         return url;