You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/04/24 21:57:04 UTC

[jira] [Commented] (ZOOKEEPER-2757) Incorrect path crashes zkCli

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-2757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15981978#comment-15981978 ] 

ASF GitHub Bot commented on ZOOKEEPER-2757:
-------------------------------------------

GitHub user afine opened a pull request:

    https://github.com/apache/zookeeper/pull/240

    ZOOKEEPER-2757: Incorrect path crashes zkCli

    This issue is caused by us relying on `IllegalArgumentException` in `PathUtils#validatePath`. `IllegalArgumentException` is an unchecked exception and we never catch it within each individual *Command.java, so it bubbles up and killed the CLI. 
    
    Given that throwing `IllegalArgumentException` is part of ZooKeeper's API, I believe that unfortunately we can not change this behavior at this time. This patch catches `IllegalArgumentException` and wraps it, so the CLI prints an error but does not quit. I believe I handled all of the relevant commands, please check to make sure I am not missing one.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/afine/zookeeper ZOOKEEPER-2757

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/zookeeper/pull/240.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #240
    
----
commit 46dce3f1c5c219b72e4e046c0bb42c1201d44238
Author: Abraham Fine <af...@apache.org>
Date:   2017-04-24T21:47:29Z

    ZOOKEEPER-2757: Incorrect path crashes zkCli

----


> Incorrect path crashes zkCli
> ----------------------------
>
>                 Key: ZOOKEEPER-2757
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2757
>             Project: ZooKeeper
>          Issue Type: Bug
>    Affects Versions: 3.5.3
>            Reporter: Flavio Junqueira
>            Assignee: Abraham Fine
>            Priority: Minor
>             Fix For: 3.5.4
>
>
> If I try {{delete test}} without the leading /, then the CLI crashes with this exception:
> {noformat}
> Exception in thread "main" java.lang.IllegalArgumentException: Path must start with / character
> 	at org.apache.zookeeper.common.PathUtils.validatePath(PathUtils.java:51)
> 	at org.apache.zookeeper.ZooKeeper.delete(ZooKeeper.java:1659)
> 	at org.apache.zookeeper.cli.DeleteCommand.exec(DeleteCommand.java:83)
> 	at org.apache.zookeeper.ZooKeeperMain.processZKCmd(ZooKeeperMain.java:655)
> 	at org.apache.zookeeper.ZooKeeperMain.processCmd(ZooKeeperMain.java:586)
> 	at org.apache.zookeeper.ZooKeeperMain.executeLine(ZooKeeperMain.java:370)
> 	at org.apache.zookeeper.ZooKeeperMain.run(ZooKeeperMain.java:330)
> 	at org.apache.zookeeper.ZooKeeperMain.main(ZooKeeperMain.java:292)
> {noformat}
> It should really fail the operation rather than crash the CLI.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)