You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by md...@apache.org on 2011/07/06 13:15:59 UTC

svn commit: r1143344 - /jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/PathUtils.java

Author: mduerig
Date: Wed Jul  6 11:15:58 2011
New Revision: 1143344

URL: http://svn.apache.org/viewvc?rev=1143344&view=rev
Log:
comment, clean up

Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/PathUtils.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/PathUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/PathUtils.java?rev=1143344&r1=1143343&r2=1143344&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/PathUtils.java (original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/PathUtils.java Wed Jul  6 11:15:58 2011
@@ -166,10 +166,16 @@ public class PathUtils {
     }
 
     /**
-     * <code>relativize(parentPath, concat(parentPath, path)) == path2</code>
+     * Relativize a path wrt. a parent path such that
+     * <code>relativize(parentPath, concat(parentPath, path)) == paths</code>
+     * holds.
+     *
+     * @param parentPath  parent pth
+     * @param path        path to relativize
+     * @return  relativized path
      */
     public static String relativize(String parentPath, String path) {
-        String prefix = parentPath.charAt(parentPath.length() - 1) == '/'
+        String prefix = denotesRoot(parentPath)
             ? parentPath
             : parentPath + '/';
 
@@ -236,7 +242,7 @@ public class PathUtils {
     /**
      * Check if the path is valid, and throw an IllegalArgumentException if not.
      * A valid path is absolute (starts with a '/') or relative (doesn't start
-     * with '/'), and contain one or more elements. A path may not end with '/',
+     * with '/'), and contains none or more elements. A path may not end with '/',
      * except for the root path. Elements itself must be at least one character
      * long. Within an element, there may be one or more section starting with
      * '{' and ending with '}' that can contain any character (including '/',