incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r691792 - /incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
Date Wed, 03 Sep 2008 21:37:26 GMT
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



Mime
View raw message