Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
0.2.0-incubating, 0.1.0-incubating, 0.3.0-incubating, 0.5.0-incubating, 0.4.1-incubating, 0.6.0-incubating
-
None
Description
For a ZKClient created through ZKClients.namespace, calling create on "/" will fail with an exception "java.lang.IllegalArgumentException: Path must not end with / character". For non-namespaced ZKClient, it either succeeds or having the `NodeExistsException` exception if the root path already exist.
This is the code snippet for reproducing the issue:
ZKClient zk = ZKClients.namespace(zkClient, "/test"); zk.create("/", null, CreateMode.PERSISTENT).get();
and this is the stacktrace:
java.lang.IllegalArgumentException: Path must not end with / character at org.apache.zookeeper.common.PathUtils.validatePath(PathUtils.java:58) at org.apache.zookeeper.common.PathUtils.validatePath(PathUtils.java:35) at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:803) at org.apache.twill.internal.zookeeper.DefaultZKClientService.doCreate(DefaultZKClientService.java:147) at org.apache.twill.internal.zookeeper.DefaultZKClientService.create(DefaultZKClientService.java:137) at org.apache.twill.zookeeper.ForwardingZKClient.create(ForwardingZKClient.java:61) at org.apache.twill.internal.zookeeper.FailureRetryZKClient.create(FailureRetryZKClient.java:70) at org.apache.twill.zookeeper.ForwardingZKClient.create(ForwardingZKClient.java:61) at org.apache.twill.zookeeper.ZKClientServices$1.create(ZKClientServices.java:84) at org.apache.twill.internal.zookeeper.NamespaceZKClient.create(NamespaceZKClient.java:73) at org.apache.twill.zookeeper.AbstractZKClient.create(AbstractZKClient.java:42) at org.apache.twill.zookeeper.AbstractZKClient.create(AbstractZKClient.java:36)