You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/09/03 23:37:26 UTC

svn commit: r691792 - /incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java

Author: fmeschbe
Date: Wed Sep  3 14:37:25 2008
New Revision: 691792

URL: http://svn.apache.org/viewvc?rev=691792&view=rev
Log:
SLING-642 Cut off trailing slashes from root paths of ResourceProviders

Modified:
    incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java

Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java?rev=691792&r1=691791&r2=691792&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java (original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java Wed Sep  3 14:37:25 2008
@@ -382,6 +382,11 @@
                     "ResourceProvider", reference);
 
                 for (String root : roots) {
+                    // cut off trailing slash
+                    if (root.endsWith("/") && root.length() > 1) {
+                        root = root.substring(0, root.length() - 1);
+                    }
+                    
                     try {
                         rootProviderEntry.addResourceProvider(root, provider);
                     } catch (IllegalStateException ise) {
@@ -398,6 +403,11 @@
         String[] roots = OsgiUtil.toStringArray(reference.getProperty(ResourceProvider.ROOTS));
         if (roots != null && roots.length > 0) {
             for (String root : roots) {
+                // cut off trailing slash
+                if (root.endsWith("/") && root.length() > 1) {
+                    root = root.substring(0, root.length() - 1);
+                }
+                
                 // TODO: Do not remove this path, if another resource
                 // owns it. This may be the case if adding the provider
                 // yielded an IllegalStateException