jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r792589 - in /jackrabbit/trunk/jackrabbit-jcr-commons/src: main/java/org/apache/jackrabbit/util/Text.java test/java/org/apache/jackrabbit/util/TextTest.java
Date Thu, 09 Jul 2009 15:49:00 GMT
Author: angela
Date: Thu Jul  9 15:49:00 2009
New Revision: 792589

URL: http://svn.apache.org/viewvc?rev=792589&view=rev
Log:
JCR-2198: Text.escapeIllegalJCRChars should be adjusted to match the 2.0 set of illegal chars

Modified:
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/TextTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java?rev=792589&r1=792588&r2=792589&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java
Thu Jul  9 15:49:00 2009
@@ -453,12 +453,12 @@
      * QName EBNF:<br>
      * <xmp>
      * simplename ::= onecharsimplename | twocharsimplename | threeormorecharname
-     * onecharsimplename ::= (* Any Unicode character except: '.', '/', ':', '[', ']', '*',
''', '"', '|' or any whitespace character *)
+     * onecharsimplename ::= (* Any Unicode character except: '.', '/', ':', '[', ']', '*',
'|' or any whitespace character *)
      * twocharsimplename ::= '.' onecharsimplename | onecharsimplename '.' | onecharsimplename
onecharsimplename
      * threeormorecharname ::= nonspace string nonspace
      * string ::= char | string char
      * char ::= nonspace | ' '
-     * nonspace ::= (* Any Unicode character except: '/', ':', '[', ']', '*', ''', '"', '|'
or any whitespace character *)
+     * nonspace ::= (* Any Unicode character except: '/', ':', '[', ']', '*', '|' or any
whitespace character *)
      * </xmp>
      *
      * @param name the name to escape
@@ -469,7 +469,7 @@
         for (int i = 0; i < name.length(); i++) {
             char ch = name.charAt(i);
             if (ch == '%' || ch == '/' || ch == ':' || ch == '[' || ch == ']'
-                || ch == '*' || ch == '\'' || ch == '"' || ch == '|'
+                || ch == '*' || ch == '|'
                 || (ch == '.' && name.length() < 3)
                 || (ch == ' ' && (i == 0 || i == name.length() - 1))
                 || ch == '\t' || ch == '\r' || ch == '\n') {
@@ -483,7 +483,8 @@
         return buffer.toString();
     }
 
-    /** Escapes all illegal XPath search characters of a string.
+    /**
+     * Escapes all illegal XPath search characters of a string.
      * <p>Example:<br>
      * A search string like 'test?' will run into a ParseException
      * documented in http://issues.apache.org/jira/browse/JCR-1248

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/TextTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/TextTest.java?rev=792589&r1=792588&r2=792589&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/TextTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/TextTest.java
Thu Jul  9 15:49:00 2009
@@ -182,5 +182,11 @@
             fail("Text.unescape(" + string + "): " + unexpected.getMessage());
         }
     }
+        
+    public void testEscapeIllegalJcrChars() throws Exception {
 
+        // single and double quote are valid since JCR 2.0
+        assertEquals("local'name", Text.escapeIllegalJcrChars("local'name"));
+        assertEquals("local\"name", Text.escapeIllegalJcrChars("local\"name"));       
+    }
 }



Mime
View raw message