diff --git a/CHANGES.txt b/CHANGES.txt index f0c6400be2184b687ed84989bb06dfca5870380b..14fe140d446347861c14d352a2e2e9e7c8d39144 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -311,6 +311,9 @@ BUGFIXES: ZK-1504) opens selectors but never closes them (Thawan Kooburat via phunt) + ZOOKEEPER-1628. Documented list of allowable characters in ZK doc + not in line with code (Gabriel Reid via phunt) + IMPROVEMENTS: ZOOKEEPER-1170. Fix compiler (eclipse) warnings: unused imports, diff --git a/docs/index.pdf b/docs/index.pdf index ad6b453a17b4f5d66b2eb171e9e1b2f382514743..8a72ad3eec8aaa5a1bb059e65f8dc91146526a7d 100644 Binary files a/docs/index.pdf and b/docs/index.pdf differ diff --git a/docs/javaExample.pdf b/docs/javaExample.pdf index a8d1f22565a6911718a5e4ac297c1816f7098b8a..36cfbd0a7d11af18393ee4d5d3fa4420e90ce365 100644 Binary files a/docs/javaExample.pdf and b/docs/javaExample.pdf differ diff --git a/docs/linkmap.pdf b/docs/linkmap.pdf index b5eff4b806cec92efb3fb142f4b90f24961f59d1..fa848a70b6aee44443a74430b12d8b34d6de9e1c 100644 Binary files a/docs/linkmap.pdf and b/docs/linkmap.pdf differ diff --git a/docs/recipes.pdf b/docs/recipes.pdf index 93a2760b46d6a7d1abe73c974f0f15877a269692..5df89f680be19842252b30846f4dc35ba4367b95 100644 Binary files a/docs/recipes.pdf and b/docs/recipes.pdf differ diff --git a/docs/releasenotes.pdf b/docs/releasenotes.pdf index 618b47e4aefda40dcf16b29eaeecfdca1a28b57f..a0887a2e3fb28b0e1af7003e7d5ae9c5da96434a 100644 Binary files a/docs/releasenotes.pdf and b/docs/releasenotes.pdf differ diff --git a/docs/zookeeperAdmin.pdf b/docs/zookeeperAdmin.pdf index ed595d2f883323692117b0e25d12117e70c558c6..c67e2c84fe1cf5130c5ae226548568821db72eb8 100644 Binary files a/docs/zookeeperAdmin.pdf and b/docs/zookeeperAdmin.pdf differ diff --git a/docs/zookeeperHierarchicalQuorums.pdf b/docs/zookeeperHierarchicalQuorums.pdf index 61ea23c6e1ec3460905dbaf8906bfbe91e01eb02..efdb8e4b056e721454b2cf993863aab4d0c6e797 100644 Binary files a/docs/zookeeperHierarchicalQuorums.pdf and b/docs/zookeeperHierarchicalQuorums.pdf differ diff --git a/docs/zookeeperInternals.pdf b/docs/zookeeperInternals.pdf index 28cb5505426c497f1a9fd89da67f191c5d6dadbf..b8c96d790ae966bf7bf38d61ca23400d271a7748 100644 Binary files a/docs/zookeeperInternals.pdf and b/docs/zookeeperInternals.pdf differ diff --git a/docs/zookeeperJMX.pdf b/docs/zookeeperJMX.pdf index f654b606717eb85021e5fea585a89cf34f22b08c..b7757244984d559eb5f75d7a097ea623d7c8be92 100644 Binary files a/docs/zookeeperJMX.pdf and b/docs/zookeeperJMX.pdf differ diff --git a/docs/zookeeperObservers.pdf b/docs/zookeeperObservers.pdf index 4b337d1b64b927763eb144e2daa90d0ef4c61f84..48e64166d5e6ec5c759f60bda8bb79ef8d372ff8 100644 Binary files a/docs/zookeeperObservers.pdf and b/docs/zookeeperObservers.pdf differ diff --git a/docs/zookeeperOver.pdf b/docs/zookeeperOver.pdf index 94c9229c7a334f10375674d5b0307f0306d7b25d..d0416c28b40e9698165e909bbe2325ba13be633c 100644 Binary files a/docs/zookeeperOver.pdf and b/docs/zookeeperOver.pdf differ diff --git a/docs/zookeeperProgrammers.html b/docs/zookeeperProgrammers.html index ddc40781e6193463633fb58b0cbb7f829f48a632..92c0e84672c9cf55eb01dc3d7bc0c120896a5f35 100644 --- a/docs/zookeeperProgrammers.html +++ b/docs/zookeeperProgrammers.html @@ -443,7 +443,7 @@ document.write("Last Published: " + document.lastModified); <li> <p>The following characters can't be used because they don't - display well, or render in confusing ways: \u0001 - \u0019 and \u007F + display well, or render in confusing ways: \u0001 - \u001F and \u007F - \u009F.</p> </li> @@ -451,8 +451,8 @@ document.write("Last Published: " + document.lastModified); <li> -<p>The following characters are not allowed: \ud800 -uF8FFF, - \uFFF0-uFFFF, \uXFFFE - \uXFFFF (where X is a digit 1 - E), \uF0000 - +<p>The following characters are not allowed: \ud800 - uF8FF, + \uFFF0 - uFFFF, \uXFFFE - \uXFFFF (where X is a digit 1 - E), \uF0000 - \uFFFFF.</p> </li> diff --git a/docs/zookeeperProgrammers.pdf b/docs/zookeeperProgrammers.pdf index edf97cee78d2a7e0fbe98d158ea315d7f158abca..15c9d7deed470f65da3710584b03d25fbf710b69 100644 Binary files a/docs/zookeeperProgrammers.pdf and b/docs/zookeeperProgrammers.pdf differ diff --git a/docs/zookeeperQuotas.pdf b/docs/zookeeperQuotas.pdf index a8a1d6cd4c1df985b649dc8832b28569009f907d..d3533658517e10e602c76f37e23d18c4c01c492a 100644 Binary files a/docs/zookeeperQuotas.pdf and b/docs/zookeeperQuotas.pdf differ diff --git a/docs/zookeeperStarted.pdf b/docs/zookeeperStarted.pdf index c9d97760d3d6816ba325ec11ad7fa15d1dd5e692..85af36c97e187e92c40e9fdc367418be81c4c460 100644 Binary files a/docs/zookeeperStarted.pdf and b/docs/zookeeperStarted.pdf differ diff --git a/docs/zookeeperTutorial.pdf b/docs/zookeeperTutorial.pdf index af356f13ef8e67a7a8555ef0fd6834842222bce2..7a69bcb8cb0a907f6e0494ced92cf35b3b0502b0 100644 Binary files a/docs/zookeeperTutorial.pdf and b/docs/zookeeperTutorial.pdf differ diff --git a/src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml b/src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml index fe84542ed89a69fc3b155bd7b5b2aba928fe5deb..784ad0c5ab77b2205ac1182edbaa454399025299 100644 --- a/src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml +++ b/src/docs/src/documentation/content/xdocs/zookeeperProgrammers.xml @@ -133,13 +133,13 @@ <listitem> <para>The following characters can't be used because they don't - display well, or render in confusing ways: \u0001 - \u0019 and \u007F + display well, or render in confusing ways: \u0001 - \u001F and \u007F - \u009F.</para> </listitem> <listitem> - <para>The following characters are not allowed: \ud800 -uF8FFF, - \uFFF0-uFFFF, \uXFFFE - \uXFFFF (where X is a digit 1 - E), \uF0000 - + <para>The following characters are not allowed: \ud800 - uF8FF, + \uFFF0 - uFFFF, \uXFFFE - \uXFFFF (where X is a digit 1 - E), \uF0000 - \uFFFFF.</para> </listitem> diff --git a/src/java/main/org/apache/zookeeper/common/PathUtils.java b/src/java/main/org/apache/zookeeper/common/PathUtils.java index 12a68142b4e12990787f6c90c38f3d72e797e55b..e479787e216078d60223e80189d3607ba5f5ffc5 100644 --- a/src/java/main/org/apache/zookeeper/common/PathUtils.java +++ b/src/java/main/org/apache/zookeeper/common/PathUtils.java @@ -86,10 +86,10 @@ public class PathUtils { reason = "relative paths not allowed @" + i; break; } - } else if (c > '\u0000' && c < '\u001f' - || c > '\u007f' && c < '\u009F' - || c > '\ud800' && c < '\uf8ff' - || c > '\ufff0' && c < '\uffff') { + } else if (c > '\u0000' && c <= '\u001f' + || c >= '\u007f' && c <= '\u009F' + || c >= '\ud800' && c <= '\uf8ff' + || c >= '\ufff0' && c <= '\uffff') { reason = "invalid charater @" + i; break; } diff --git a/src/java/test/org/apache/zookeeper/common/PathUtilsTest.java b/src/java/test/org/apache/zookeeper/common/PathUtilsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9b224ee28af5b6569bbc8278a708e3513e587db5 --- /dev/null +++ b/src/java/test/org/apache/zookeeper/common/PathUtilsTest.java @@ -0,0 +1,128 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.zookeeper.common; + +import org.junit.Test; + +public class PathUtilsTest { + + @Test + public void testValidatePath_ValidPath() { + PathUtils.validatePath("/this is / a valid/path"); + } + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_Null() { + PathUtils.validatePath(null); + } + + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_EmptyString() { + PathUtils.validatePath(""); + } + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_NotAbsolutePath() { + PathUtils.validatePath("not/valid"); + } + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_EndsWithSlash() { + PathUtils.validatePath("/ends/with/slash/"); + } + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_ContainsNullCharacter() { + PathUtils.validatePath("/test\u0000"); + } + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_DoubleSlash() { + PathUtils.validatePath("/double//slash"); + } + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_SinglePeriod() { + PathUtils.validatePath("/single/./period"); + } + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_DoublePeriod() { + PathUtils.validatePath("/double/../period"); + } + + @Test + public void testValidatePath_NameContainingPeriod() { + // A period that isn't on its own is ok + PathUtils.validatePath("/name/with.period."); + } + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_0x01() { + PathUtils.validatePath("/test\u0001"); + } + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_0x1F() { + PathUtils.validatePath("/test\u001F"); + } + + @Test // The first allowable character + public void testValidatePath_0x20() { + PathUtils.validatePath("/test\u0020"); + } + + @Test + public void testValidatePath_0x7e() { + // The last valid ASCII character + PathUtils.validatePath("/test\u007e"); + } + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_0x7f() { + PathUtils.validatePath("/test\u007f"); + } + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_0x9f() { + PathUtils.validatePath("/test\u009f"); + } + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_ud800() { + PathUtils.validatePath("/test\ud800"); + } + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_uf8ff() { + PathUtils.validatePath("/test\uf8ff"); + } + + @Test + public void testValidatePath_HighestAllowableChar() { + PathUtils.validatePath("/test\uffef"); + } + + @Test(expected=IllegalArgumentException.class) + public void testValidatePath_SupplementaryChar() { + PathUtils.validatePath("/test\ufff0"); + } + +}