felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r375223 - /incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
Date Mon, 06 Feb 2006 08:50:13 GMT
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;



Mime
View raw message