You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "maoling (Jira)" <ji...@apache.org> on 2020/11/03 13:24:00 UTC

[jira] [Created] (ZOOKEEPER-3992) addWatch api should check the null watch

maoling created ZOOKEEPER-3992:
----------------------------------

             Summary: addWatch api should check the null watch
                 Key: ZOOKEEPER-3992
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3992
             Project: ZooKeeper
          Issue Type: Bug
          Components: java client
            Reporter: maoling
             Fix For: 3.7.0


{code:java}
public void addWatch(String basePath, Watcher watcher, AddWatchMode mode)
        throws KeeperException, InterruptedException {
    PathUtils.validatePath(basePath);
    String serverPath = prependChroot(basePath);

    RequestHeader h = new RequestHeader();
    h.setType(ZooDefs.OpCode.addWatch);
    AddWatchRequest request = new AddWatchRequest(serverPath, mode.getMode());
    ReplyHeader r = cnxn.submitRequest(h, request, new ErrorResponse(),
    
{code}
we need to _*validateWatcher(watcher)*_ to ** avoid the case:
{code:java}
zk.addWatch("/a/b", null, PERSISTENT_RECURSIVE);
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)