jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r523637 - /jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplEx.java
Date Thu, 29 Mar 2007 09:08:04 GMT
Author: angela
Date: Thu Mar 29 02:08:03 2007
New Revision: 523637

URL: http://svn.apache.org/viewvc?view=rev&rev=523637
Log:
JCR-825 LocatorFactoryImplEx doesn't properly evaluate resource path.

Modified:
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplEx.java

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplEx.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplEx.java?view=diff&rev=523637&r1=523636&r2=523637
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplEx.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplEx.java
Thu Mar 29 02:08:03 2007
@@ -46,7 +46,7 @@
             return resourcePath;
         }
 
-        if (resourcePath.startsWith(wspPath)) {
+        if (resourcePath.equals(wspPath) || startsWithWorkspace(resourcePath, wspPath)) {
             String repositoryPath = resourcePath.substring(wspPath.length());
             return (repositoryPath.length() == 0) ? "/" : repositoryPath;
         } else {
@@ -62,6 +62,14 @@
         if (repositoryPath == null) {
             throw new IllegalArgumentException("Cannot build resource path from 'null' repository
path");
         }
-        return (wspPath == null || repositoryPath.startsWith(wspPath)) ? repositoryPath :
wspPath + repositoryPath;
+        return (startsWithWorkspace(repositoryPath, wspPath)) ? repositoryPath : wspPath
+ repositoryPath;
+    }
+
+    private boolean startsWithWorkspace(String repositoryPath, String wspPath) {
+        if (wspPath == null) {
+            return true;
+        } else {
+            return repositoryPath.startsWith(wspPath + "/");
+        }
     }
 }



Mime
View raw message