Return-Path: X-Original-To: apmail-jackrabbit-commits-archive@www.apache.org Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2B24510C3F for ; Mon, 23 Sep 2013 15:45:34 +0000 (UTC) Received: (qmail 28864 invoked by uid 500); 23 Sep 2013 15:45:34 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 28756 invoked by uid 500); 23 Sep 2013 15:45:33 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 28738 invoked by uid 99); 23 Sep 2013 15:45:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Sep 2013 15:45:32 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Sep 2013 15:45:29 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id A409E23889BB; Mon, 23 Sep 2013 15:45:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1525630 - in /jackrabbit/branches/2.6: ./ jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/conversion/PathParserTest.java Date: Mon, 23 Sep 2013 15:45:08 -0000 To: commits@jackrabbit.apache.org From: reschke@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130923154508.A409E23889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: reschke Date: Mon Sep 23 15:45:08 2013 New Revision: 1525630 URL: http://svn.apache.org/r1525630 Log: JCR-3582 improve exception message for non-SP whitespace in node names (ported to 2.6) Modified: jackrabbit/branches/2.6/ (props changed) jackrabbit/branches/2.6/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java jackrabbit/branches/2.6/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/conversion/PathParserTest.java Propchange: jackrabbit/branches/2.6/ ------------------------------------------------------------------------------ Merged /jackrabbit/trunk:r1525629 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=1525630&r1=1525629&r2=1525630&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 Mon Sep 23 15:45:08 2013 @@ -251,9 +251,11 @@ public class PathParser { while (pos <= len) { char c = pos == len ? EOF : jcrPath.charAt(pos); + char rawCharacter = c; pos++; // special check for whitespace if (c != ' ' && Character.isWhitespace(c)) { + rawCharacter = c; c = '\t'; } switch (c) { @@ -394,7 +396,9 @@ public class PathParser { case '\t': if (state != STATE_IDENTIFIER) { - throw new MalformedPathException("'" + jcrPath + "' is not a valid path. Whitespace not a allowed in name."); + String message = String.format("'%s' is not a valid path. Whitespace other than SP (U+0020) not a allowed in a name, but U+%04x was found at position %d.", + jcrPath, (long) rawCharacter, pos - 1); + throw new MalformedPathException(message); } case '*': case '|': Modified: jackrabbit/branches/2.6/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/conversion/PathParserTest.java URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.6/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/conversion/PathParserTest.java?rev=1525630&r1=1525629&r2=1525630&view=diff ============================================================================== --- jackrabbit/branches/2.6/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/conversion/PathParserTest.java (original) +++ jackrabbit/branches/2.6/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/conversion/PathParserTest.java Mon Sep 23 15:45:08 2013 @@ -259,6 +259,7 @@ public class PathParserTest extends Test paths.add("/:"); paths.add("/*"); paths.add("//"); + paths.add("foo\u3000bar"); // non-ASCII whitespace for (String jcrPath : paths) { try { @@ -382,9 +383,9 @@ public class PathParserTest extends Test } catch (MalformedPathException e) { // ok } - } + } } - + public void testIdentifierCheckFormat() throws RepositoryException { DummyIdentifierResolver idResolver = new DummyIdentifierResolver(); List valid = idResolver.getValidIdentifiers();