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

eolivelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
     new 39ed945  CURATOR-585: fix DiscoveryExample did not check for exceptions
39ed945 is described below

commit 39ed945af4147289d98cd2089e39954d09448577
Author: wangjie <[email protected]>
AuthorDate: Mon Jan 18 12:01:42 2021 +0100

    CURATOR-585: fix DiscoveryExample did not check for exceptions
    
    Author: wangjie <[email protected]>
    
    Reviewers: Enrico Olivelli <[email protected]>
    
    Closes #375 from iwangjie/CURATOR-585
---
 curator-examples/src/main/java/discovery/DiscoveryExample.java | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/curator-examples/src/main/java/discovery/DiscoveryExample.java 
b/curator-examples/src/main/java/discovery/DiscoveryExample.java
index d377e5e..a7ad398 100644
--- a/curator-examples/src/main/java/discovery/DiscoveryExample.java
+++ b/curator-examples/src/main/java/discovery/DiscoveryExample.java
@@ -33,6 +33,8 @@ import org.apache.curator.x.discovery.ServiceInstance;
 import org.apache.curator.x.discovery.ServiceProvider;
 import org.apache.curator.x.discovery.details.JsonInstanceSerializer;
 import org.apache.curator.x.discovery.strategies.RandomStrategy;
+import org.apache.zookeeper.KeeperException;
+
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.util.Arrays;
@@ -191,6 +193,11 @@ public class DiscoveryExample
                     outputInstance(instance);
                 }
             }
+
+        }
+        catch ( KeeperException.NoNodeException e )
+        {
+            System.err.println("There are no registered instances.");
         }
         finally
         {

Reply via email to