You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2018/10/18 07:27:59 UTC

[aries-rsa] branch master updated: ARIES-1847 - Avoid IllegalArgumentException: Path cannot be null

This is an automated email from the ASF dual-hosted git repository.

cschneider pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-rsa.git


The following commit(s) were added to refs/heads/master by this push:
     new 1a6a5e1  ARIES-1847 - Avoid IllegalArgumentException: Path cannot be null
1a6a5e1 is described below

commit 1a6a5e114dc957506110d70b3e0276c00407b890
Author: Christian Schneider <cs...@adobe.com>
AuthorDate: Thu Oct 18 09:27:49 2018 +0200

    ARIES-1847 - Avoid IllegalArgumentException: Path cannot be null
---
 .../repository/ZookeeperEndpointRepository.java      | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/repository/ZookeeperEndpointRepository.java b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/repository/ZookeeperEndpointRepository.java
index 4f298ef..a1d851f 100644
--- a/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/repository/ZookeeperEndpointRepository.java
+++ b/discovery/zookeeper/src/main/java/org/apache/aries/rsa/discovery/zookeeper/repository/ZookeeperEndpointRepository.java
@@ -38,7 +38,6 @@ import org.apache.zookeeper.KeeperException.NodeExistsException;
 import org.apache.zookeeper.KeeperException.SessionExpiredException;
 import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.Watcher.Event.EventType;
 import org.apache.zookeeper.ZooDefs.Ids;
 import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.data.Stat;
@@ -139,11 +138,18 @@ public class ZookeeperEndpointRepository implements Closeable, Watcher {
     @Override
     public void process(WatchedEvent event) {
         LOG.info("Received event {}", event);
-        if (event.getType() == EventType.NodeDeleted) {
-            handleRemoved(event.getPath());
-            return;
-        }
-        watchRecursive(event.getPath());
+        switch (event.getType()) {
+        case NodeCreated:
+        case NodeDataChanged:
+        case NodeChildrenChanged:
+        	watchRecursive(event.getPath());
+        	break;
+		case NodeDeleted:
+			handleRemoved(event.getPath());
+			break;
+		default:
+			break;
+		}
     }
 
     @Override
@@ -169,7 +175,7 @@ public class ZookeeperEndpointRepository implements Closeable, Watcher {
      * @param path
      */
     private void watchRecursive(String path) {
-        LOG.debug("Watching {}", path);
+        LOG.info("Watching {}", path);
         try {
             handleZNodeChanged(path);
             List<String> children = zk.getChildren(path, this);