jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1538647 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
Date Mon, 04 Nov 2013 15:26:06 GMT
Author: jukka
Date: Mon Nov  4 15:26:06 2013
New Revision: 1538647

URL: http://svn.apache.org/r1538647
Log:
OAK-1015: Optimise path parsing

Handle the "foo:bar:baz" case brought up by Michael

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java?rev=1538647&r1=1538646&r2=1538647&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImpl.java
Mon Nov  4 15:26:06 2013
@@ -260,14 +260,19 @@ public class NamePathMapperImpl implemen
                 }
                 break;
             case ':':
-                if (i == slash + 1 || i == colon + i || i + 1 == length) {
-                    return true; // colon following slash/colon or as last char
+                if (i == slash + 1              // "x/:y"
+                        || i == colon + i       // "x::y"
+                        || colon > slash        // "x:y:z"
+                        || i + 1 == length) {   // "x:"
+                    return true;
                 }
                 colon = i;
                 break;
             case '/':
-                if (i == slash + 1 || i == colon + i || i + 1 == length) {
-                    return true; // colon following slash/colon or as last char
+                if (i == slash + 1              // "x//y"
+                        || i == colon + i       // "x:/y"
+                        || i + 1 == length) {   // "x/"
+                    return true;
                 }
                 slash = i;
                 break;

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java?rev=1538647&r1=1538646&r2=1538647&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
Mon Nov  4 15:26:06 2013
@@ -160,8 +160,14 @@ public class NamePathMapperImplTest {
 
     @Test
     public void testInvalidJcrPaths() {
-        String[] paths = {"//", "/foo//", "/..//", "/..", "/foo/../.."};
-
+        String[] paths = {
+                "//",
+                "/foo//",
+                "/..//",
+                "/..",
+                "/foo/../..",
+                "foo::bar",
+                "foo:bar:baz" };
         for (String path : paths) {
             assertNull(npMapper.getOakPath(path));
         }



Mime
View raw message