You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by Harsh J <ha...@cloudera.com> on 2011/12/11 21:03:32 UTC
Why do we check for a trailing slash in paths?
Hey all,
Would anyone happen to know why we strictly check against a trailing slash in client-provided paths to various commands?
Specifically, this error:
[zk: localhost:2181(CONNECTED) 0] ls /storm/
Command failed: java.lang.IllegalArgumentException: Path must not end with / character
If there's no strong reason nor is it harmful to, perhaps I could go ahead and open up a JIRA to remove a trailing slash instead of throwing out an exception?
Thanks,
./Harsh
Re: Why do we check for a trailing slash in paths?
Posted by Patrick Hunt <ph...@apache.org>.
We should explicitly call it out here:
http://zookeeper.apache.org/doc/r3.3.4/zookeeperProgrammers.html#ch_zkDataModel
Patrick
2011/12/12 Daniel Gómez Ferro <da...@yahoo-inc.com>:
> Hi,
>
> If we allow using a trailing '/' somebody might think that it is always fine to have it, but for example create can have different meanings if the path has a trailing '/' or not:
> zk.create("/test", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL) -> creates /test0000000000
> zk.create("/test/", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL) -> creates /test/0000000000
>
> If we still allow it documenting this clearly might be enough, I don't know.
>
> On Dec 11, 2011, at 21:03 , Harsh J wrote:
>
>> Hey all,
>>
>> Would anyone happen to know why we strictly check against a trailing slash in client-provided paths to various commands?
>>
>> Specifically, this error:
>>
>> [zk: localhost:2181(CONNECTED) 0] ls /storm/
>> Command failed: java.lang.IllegalArgumentException: Path must not end with / character
>>
>> If there's no strong reason nor is it harmful to, perhaps I could go ahead and open up a JIRA to remove a trailing slash instead of throwing out an exception?
>>
>> Thanks,
>> ./Harsh
>
Re: Why do we check for a trailing slash in paths?
Posted by Daniel Gómez Ferro <da...@yahoo-inc.com>.
Hi,
If we allow using a trailing '/' somebody might think that it is always fine to have it, but for example create can have different meanings if the path has a trailing '/' or not:
zk.create("/test", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL) -> creates /test0000000000
zk.create("/test/", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL) -> creates /test/0000000000
If we still allow it documenting this clearly might be enough, I don't know.
On Dec 11, 2011, at 21:03 , Harsh J wrote:
> Hey all,
>
> Would anyone happen to know why we strictly check against a trailing slash in client-provided paths to various commands?
>
> Specifically, this error:
>
> [zk: localhost:2181(CONNECTED) 0] ls /storm/
> Command failed: java.lang.IllegalArgumentException: Path must not end with / character
>
> If there's no strong reason nor is it harmful to, perhaps I could go ahead and open up a JIRA to remove a trailing slash instead of throwing out an exception?
>
> Thanks,
> ./Harsh