zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mic...@apache.org
Subject svn commit: r1522079 - /zookeeper/trunk/src/java/test/org/apache/zookeeper/server/NIOServerCnxnTest.java
Date Wed, 11 Sep 2013 22:26:52 GMT
Author: michim
Date: Wed Sep 11 22:26:52 2013
New Revision: 1522079

URL: http://svn.apache.org/r1522079
Log:
ZOOKEEPER-1750 Handle NIOServerCnxn#toString returning null (Rakesh R via michim)

Modified:
    zookeeper/trunk/src/java/test/org/apache/zookeeper/server/NIOServerCnxnTest.java

Modified: zookeeper/trunk/src/java/test/org/apache/zookeeper/server/NIOServerCnxnTest.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/NIOServerCnxnTest.java?rev=1522079&r1=1522078&r2=1522079&view=diff
==============================================================================
--- zookeeper/trunk/src/java/test/org/apache/zookeeper/server/NIOServerCnxnTest.java (original)
+++ zookeeper/trunk/src/java/test/org/apache/zookeeper/server/NIOServerCnxnTest.java Wed Sep
11 22:26:52 2013
@@ -27,8 +27,12 @@ import org.apache.zookeeper.ZooDefs.Ids;
 import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.test.ClientBase;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class NIOServerCnxnTest extends ClientBase {
+    private static final Logger LOG = LoggerFactory
+                        .getLogger(NIOServerCnxnTest.class);
 
     /**
      * Test operations on ServerCnxn after socket closure.
@@ -52,10 +56,14 @@ public class NIOServerCnxnTest extends C
                     serverFactory instanceof NIOServerCnxnFactory);
             Iterable<ServerCnxn> connections = serverFactory.getConnections();
             for (ServerCnxn serverCnxn : connections) {
-                String cnxnStr = serverCnxn.toString();
                 serverCnxn.close();
-                Assert.assertEquals("Connection mismatches!", cnxnStr,
-                        serverCnxn.toString());
+                try {
+                    serverCnxn.toString();
+                } catch (Exception e) {
+                    LOG.error("Exception while getting connection details!", e);
+                    Assert.fail("Shouldn't throw exception while "
+                            + "getting connection details!");
+                }
             }
         } finally {
             zk.close();



Mime
View raw message