Terence Yim created TWILL-141:
---------------------------------

             Summary: ZKClient created through ZKClients.namespace fails in 
create call
                 Key: TWILL-141
                 URL: https://issues.apache.org/jira/browse/TWILL-141
             Project: Apache Twill
          Issue Type: Bug
          Components: zookeeper
            Reporter: Terence Yim
            Assignee: Terence Yim


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:

{code:java}
ZKClient zk = ZKClients.namespace(zkClient, "/test");
zk.create("/", null, CreateMode.PERSISTENT).get();
{code}

and this is the stacktrace:

{noformat}
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)
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to