jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1466956 - in /jackrabbit/branches/2.6: ./ jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java
Date Thu, 11 Apr 2013 16:34:05 GMT
Author: reschke
Date: Thu Apr 11 16:34:05 2013
New Revision: 1466956

URL: http://svn.apache.org/r1466956
Log:
JCR-3562: fix NameParser to accept "{a" as a valid local (non-expanded) name (ported to 2.6)

Modified:
    jackrabbit/branches/2.6/   (props changed)
    jackrabbit/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java
    jackrabbit/branches/2.6/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java

Propchange: jackrabbit/branches/2.6/
------------------------------------------------------------------------------
  Merged /jackrabbit/trunk:r1466938

Modified: jackrabbit/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java?rev=1466956&r1=1466955&r2=1466956&view=diff
==============================================================================
--- jackrabbit/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java
(original)
+++ jackrabbit/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java
Thu Apr 11 16:34:05 2013
@@ -397,4 +397,16 @@ public class NodeImplTest extends Abstra
         root.remove();
         session.save();
     }
+
+    public void testBracketsInNodeName() throws Exception {
+        final Node root = testRootNode.addNode("testBracketsInNodeName");
+
+        final String[] childNames = { "{A}", "B}", "{C", "(D)", "E)", "(F", };
+
+        for (String name : childNames) {
+            root.addNode(name);
+            root.getSession().save();
+            assertTrue("Expecting child " + name + " to have been created", root.hasNode(name));
+        }
+    }
 }

Modified: jackrabbit/branches/2.6/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.6/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java?rev=1466956&r1=1466955&r2=1466956&view=diff
==============================================================================
--- jackrabbit/branches/2.6/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java
(original)
+++ jackrabbit/branches/2.6/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java
Thu Apr 11 16:34:05 2013
@@ -47,7 +47,7 @@ public class PathParser {
 
     /**
      * Parses <code>jcrPath</code> into a <code>Path</code> object
using
-     * <code>resolver</code> to convert prefixes into namespace URI's. If
+     * <code>resolver</code> to convert prefixes into namespace URIs. If
      * resolver is <code>null</code> this method only checks the format of the
      * passed String and returns <code>null</code>.
      *
@@ -66,7 +66,7 @@ public class PathParser {
 
     /**
      * Parses <code>jcrPath</code> into a <code>Path</code> object
using
-     * <code>resolver</code> to convert prefixes into namespace URI's. If the
+     * <code>resolver</code> to convert prefixes into namespace URIs. If the
      * specified <code>jcrPath</code> is an identifier based absolute path
      * beginning with an identifier segment the specified
      * <code>IdentifierResolver</code> will be used to resolve it to an
@@ -94,7 +94,7 @@ public class PathParser {
 
     /**
      * Parses <code>jcrPath</code> into a <code>Path</code> object
using
-     * <code>resolver</code> to convert prefixes into namespace URI's. If the
+     * <code>resolver</code> to convert prefixes into namespace URIs. If the
      * specified <code>jcrPath</code> is an identifier based absolute path
      * beginning with an identifier segment the specified
      * <code>IdentifierResolver</code> will be used to resolve it to an
@@ -132,7 +132,7 @@ public class PathParser {
      * @param parent   the parent path
      * @param jcrPath  the JCR path
      * @param resolver the namespace resolver to get prefixes for namespace
-     *                 URI's.
+     *                 URIs.
      * @param factory
      * @return the <code>Path</code> object.
      * @throws MalformedPathException If the <code>jcrPath</code> is malformed.
@@ -262,6 +262,10 @@ public class PathParser {
                     if (state == STATE_PREFIX_START && c != EOF) {
                         throw new MalformedPathException("'" + jcrPath + "' is not a valid
path. double slash '//' not allowed.");
                     }
+                    if (state == STATE_URI && c == EOF) {
+                        // this handles the case where URI state was entered but the end
of the segment was reached (JCR-3562)
+                        state = STATE_URI_END;
+                    }
                     if (state == STATE_PREFIX
                             || state == STATE_NAME
                             || state == STATE_INDEX_END
@@ -289,7 +293,7 @@ public class PathParser {
                         index = Path.INDEX_UNDEFINED;
                     } else if (state == STATE_IDENTIFIER) {
                         if (c == EOF) {
-                            // eof identifier reached                            
+                            // eof identifier reached
                             if (jcrPath.charAt(pos - 2) != ']') {
                                 throw new MalformedPathException("'" + jcrPath + "' is not
a valid path: Unterminated identifier segment.");
                             }
@@ -414,7 +418,7 @@ public class PathParser {
                         state = STATE_URI_END;
                     }
                     break;
-                
+
                 default:
                     if (state == STATE_PREFIX_START || state == STATE_DOT || state == STATE_DOTDOT)
{
                         state = STATE_PREFIX;



Mime
View raw message