[ https://issues.apache.org/jira/browse/CURATOR-128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14077398#comment-14077398 ]
Cameron McKenzie commented on CURATOR-128: ------------------------------------------ This sounds ok to me. It assumes that no one is basing any logic on the makePath() method throwing errors for particular cases though. It seems like an unlikely use case. > There is no namespace-safe way to refer to the root node > -------------------------------------------------------- > > Key: CURATOR-128 > URL: https://issues.apache.org/jira/browse/CURATOR-128 > Project: Apache Curator > Issue Type: Bug > Components: Framework > Reporter: Scott Blum > > Add the following test to TestNamespaceFacade: > {code} > @Test > public void testRootAccess() throws Exception > { > CuratorFramework client = > CuratorFrameworkFactory.newClient(server.getConnectString(), new > RetryOneTime(1)); > try > { > client.start(); > client.create().forPath("/one"); > > Assert.assertNotNull(client.getZookeeperClient().getZooKeeper().exists("/one", > false)); > Assert.assertNotNull(client.checkExists().forPath("/")); > try > { > client.checkExists().forPath(""); > Assert.fail("IllegalArgumentException expected"); > } > catch ( IllegalArgumentException expected ) > { > } > > Assert.assertNotNull(client.usingNamespace("one").checkExists().forPath("")); > try > { > client.usingNamespace("one").checkExists().forPath("/"); > Assert.fail("IllegalArgumentException expected"); > } > catch ( IllegalArgumentException expected ) > { > } > } > finally > { > CloseableUtils.closeQuietly(client); > } > } > {code} > This tests PASSES, which means that there's no canonical way to refer to the > root node. If the client is not namespaced, "/" works and "" does not work. > If the client is namespaced, "" works and "/" does not. > In either case, I think ZKPaths.makePath mishandles certain cases. > If you append "/foo" and "/" the result is "/foo/" which is an invalid path. > On the other hand, if you append "" and "bar" the result is "//bar" which is > also invalid. > What's the right behavior here? Does the root node / root of a namespace > always need to be referred to as "/" or is empty string an acceptable alias? -- This message was sent by Atlassian JIRA (v6.2#6252)