jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r779624 - in /jackrabbit/trunk/jackrabbit-spi-commons/src: main/java/org/apache/jackrabbit/spi/commons/conversion/ test/java/org/apache/jackrabbit/spi/commons/name/
Date Thu, 28 May 2009 15:21:04 GMT
Author: angela
Date: Thu May 28 15:21:03 2009
New Revision: 779624

URL: http://svn.apache.org/viewvc?rev=779624&view=rev
Log:
JCR-2028: JCR Path
JCR-1712: JCR Names

removed check for ' and " as they aren't invalid any more with JCR 2.0

Modified:
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/name/JcrName.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/name/JcrPath.java

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java?rev=779624&r1=779623&r2=779624&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java
Thu May 28 15:21:03 2009
@@ -94,7 +94,7 @@
                     throw new IllegalNameException("'" + c + "' not valid name start");
                 }
                 trailingSpaces = true;
-            } else if (Character.isWhitespace(c) || c == '[' || c == ']' || c == '*' || c
== '\'' || c == '\"') {
+            } else if (Character.isWhitespace(c) || c == '[' || c == ']' || c == '*' || c
== '|') {
                 throw new IllegalNameException("'" + c + "' not allowed in name");
             } else if (c == '/') {
                 if (state == STATE_URI_START) {

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java?rev=779624&r1=779623&r2=779624&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java
Thu May 28 15:21:03 2009
@@ -401,10 +401,8 @@
                         throw new MalformedPathException("'" + jcrPath + "' is not a valid
path. Whitespace not a allowed in name.");
                     }
                 case '*':
-                case '\'':
-                case '\"':
+                case '|':
                     if (state != STATE_IDENTIFIER) {
-                        // TODO for JCR 2.0 remove limitation of ' and "
                         throw new MalformedPathException("'" + jcrPath + "' is not a valid
path. '" + c + "' not a valid name character.");
                     }
                 case '{':

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/name/JcrName.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/name/JcrName.java?rev=779624&r1=779623&r2=779624&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/name/JcrName.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/name/JcrName.java
Thu May 28 15:21:03 2009
@@ -39,6 +39,17 @@
         list.add(new JcrName("...", "", "..."));
         list.add(new JcrName(".a.", "", ".a."));
 
+        // valid names since jcr 2.0
+        list.add(new JcrName("a'", "", "a'"));                   // single quote
+        list.add(new JcrName("'a", "", "'a"));
+        list.add(new JcrName("ab'c", "", "ab'c"));
+        list.add(new JcrName("prefix:ab'c", "prefix", "ab'c"));
+
+        list.add(new JcrName("a\"", "", "a\""));                 // double quote
+        list.add(new JcrName("\"a", "", "\"a"));
+        list.add(new JcrName("ab\"c", "", "ab\"c"));
+        list.add(new JcrName("prefix:ab\"c", "prefix", "ab\"c"));       
+
         // expanded names
         list.add(new JcrName("{}a", "", "a"));
         list.add(new JcrName("{}name", "", "name"));
@@ -60,11 +71,22 @@
         list.add(new JcrName("prefix:name "));
         list.add(new JcrName("pre fix:name"));
         list.add(new JcrName("prefix :name"));
+
         list.add(new JcrName("name/name"));
+
         list.add(new JcrName("name[name"));
         list.add(new JcrName("name]name"));
+        list.add(new JcrName("name[]"));
+        list.add(new JcrName("name[123]"));
+
         list.add(new JcrName("name*name"));
+
         list.add(new JcrName("prefix:name:name"));
+
+        list.add(new JcrName("name|name"));
+        list.add(new JcrName("|name"));
+        list.add(new JcrName("name|"));
+        list.add(new JcrName("prefix:name|name"));
     }
 
     private static JcrName[] tests = (JcrName[]) list.toArray(new JcrName[list.size()]);

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/name/JcrPath.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/name/JcrPath.java?rev=779624&r1=779623&r2=779624&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/name/JcrPath.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/name/JcrPath.java
Thu May 28 15:21:03 2009
@@ -46,6 +46,10 @@
         list.add(new JcrPath("/a/..../", "/a/....", NOR|VAL));
         list.add(new JcrPath("/a/b:.a./", "/a/b:.a.", NOR|VAL));
 
+        // ... containing special characters allowed since JCR 2.0
+        list.add(new JcrPath("/name's[2]/'name[2]", NOR|VAL));
+        list.add(new JcrPath("/\"name\"[2]/name[2]", NOR|VAL));
+
         // relative paths
         list.add(new JcrPath("a/b/c/", "a/b/c", NOR|VAL));
         list.add(new JcrPath("a/b/c", NOR|VAL));
@@ -74,6 +78,16 @@
         list.add(new JcrPath("/..", "/..", 0));
         list.add(new JcrPath("/a/b/../../..", "/a/b/../../..", 0));
 
+        list.add(new JcrPath("/prefix:*name"));
+        list.add(new JcrPath("/prefix:n*ame"));
+        list.add(new JcrPath("/prefix:|name"));
+        list.add(new JcrPath("/prefix:n|ame"));
+
+        list.add(new JcrPath("/name[2]\""));
+        list.add(new JcrPath("/name[2]\"/name"));
+        list.add(new JcrPath("/name[2]'"));
+        list.add(new JcrPath("/name[2]'/name"));
+
         // normalized, relative paths
         list.add(new JcrPath(".", ".", NOR|VAL));
         list.add(new JcrPath("..", "..", NOR|VAL));



Mime
View raw message