incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From enor...@apache.org
Subject svn commit: r1137043 - in /sling/trunk/bundles/jcr/resource/src: main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
Date Fri, 17 Jun 2011 21:40:04 GMT
Author: enorman
Date: Fri Jun 17 21:40:03 2011
New Revision: 1137043

URL: http://svn.apache.org/viewvc?rev=1137043&view=rev
Log:
SLING-2093 empty path should map to the root

Modified:
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
    sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java?rev=1137043&r1=1137042&r2=1137043&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Fri Jun 17 21:40:03 2011
@@ -666,6 +666,9 @@ public class JcrResourceResolver
 
                 // and then we have the mapped path to work on
                 mappedPath = buf.toString();
+            } else {
+                // root if no segments
+            	mappedPath = "/";            		            	
             }
 
             LOGGER.debug("map: Alias mapping resolves to path {}", mappedPath);

Modified: sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java?rev=1137043&r1=1137042&r2=1137043&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
Fri Jun 17 21:40:03 2011
@@ -41,7 +41,6 @@ import javax.servlet.http.HttpSession;
 
 import junitx.util.PrivateAccessor;
 
-import org.apache.jackrabbit.api.security.principal.PrincipalManager;
 import org.apache.jackrabbit.api.security.user.UserManager;
 import org.apache.sling.api.SlingConstants;
 import org.apache.sling.api.resource.NonExistingResource;
@@ -1624,6 +1623,11 @@ public class JcrResourceResolverTest ext
         assertEquals(path, mapped);
     }
 
+    public void testMapEmptyPath() throws Exception {
+        String mapped = resResolver.map("");
+        assertEquals("/", mapped);
+    }
+
     public void testMapExtensionFragmentQuery() throws Exception {
         String path = rootNode.getPath();
         String mapped = resResolver.map(path);



Mime
View raw message