浏览代码

ZOOKEEPER-2978: fix potential null pointer exception when deleting node

At line 518, 'existWatches.remove(clientPath)' is null because watches for clientPath is already removed.

Author: 07c00h <07c00h@gmail.com>

Reviewers: Abraham Fine <afine@apache.org>

Closes #461 from achimbab/master
achimbab 7 年之前
父节点
当前提交
f0b67b6e49
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/java/main/org/apache/zookeeper/ZooKeeper.java

+ 1 - 1
src/java/main/org/apache/zookeeper/ZooKeeper.java

@@ -515,7 +515,7 @@ public class ZooKeeper implements AutoCloseable {
                 synchronized (existWatches) {
                     Set<Watcher> list = existWatches.remove(clientPath);
                     if (list != null) {
-                        addTo(existWatches.remove(clientPath), result);
+                        addTo(list, result);
                         LOG.warn("We are triggering an exists watch for delete! Shouldn't happen!");
                     }
                 }