jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Mueller <muel...@adobe.com>
Subject Re: svn commit: r1411900 - in /jackrabbit/oak/trunk/oak-jcr: pom.xml src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Date Wed, 21 Nov 2012 10:13:38 GMT
Hi,

For the query engine, I will need a "validate and normalize path" function
that verifies a path is syntactically correct, and simplifies it if
possible, for example:

/a/./b => /a/b
/a/../b => /b

a/.. => .
./a => a
. => 
a/. => a
/.. => invalid
.. => ..
/./. => /

This will not solve the case where a relative path starts with ".."
(possibly multiple levels). I'm wondering if that would be the only
remaining case (a normalize path would never contain "current path", plus
"parent" would always be at the beginning).

Regards,
Thomas


On 11/21/12 9:29 AM, "Angela Schreiber" <anchela@adobe.com> wrote:

>hi michael
>
>> +        TreeLocation loc = getLocation();
>> +        for (String element : PathUtils.elements(relPath)) {
>> +            if (PathUtils.denotesParent(element)) {
>> +                loc = loc.getParent();
>> +            } else if (!PathUtils.denotesCurrent(element)) {
>> +                loc = loc.getChild(element);
>> +            }  // else . ->  skip to next element
>> +        }
>> +        return loc;
>
>this is exactly the reason why i was asking for having that
>included in TreeLocation and Tree... we keep adding the exact
>same code everywhere and i am quite sure that you didn't
>cover all usages of relativePath defined by JCR API by this
>fix.
>
>this really looks troublesome and hacky to me.
>
>kind regards
>angela


Mime
View raw message