You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by mi...@apache.org on 2014/03/15 00:10:35 UTC
svn commit: r1577756 - in /zookeeper/trunk: CHANGES.txt
src/java/test/org/apache/zookeeper/test/ServerCnxnTest.java
Author: michim
Date: Fri Mar 14 23:10:35 2014
New Revision: 1577756
URL: http://svn.apache.org/r1577756
Log:
ZOOKEEPER-1862. ServerCnxnTest.testServerCnxnExpiry is intermittently failing (Rakesh R via michim)
Modified:
zookeeper/trunk/CHANGES.txt
zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ServerCnxnTest.java
Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1577756&r1=1577755&r2=1577756&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Fri Mar 14 23:10:35 2014
@@ -576,6 +576,9 @@ BUGFIXES:
ZOOKEEPER-1878. Inconsistent behavior in autocreation of dataDir and
dataLogDir (Rakesh R via michim)
+ ZOOKEEPER-1862. ServerCnxnTest.testServerCnxnExpiry is intermittently failing
+ (Rakesh R via michim)
+
IMPROVEMENTS:
ZOOKEEPER-1170. Fix compiler (eclipse) warnings: unused imports,
Modified: zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ServerCnxnTest.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ServerCnxnTest.java?rev=1577756&r1=1577755&r2=1577756&view=diff
==============================================================================
--- zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ServerCnxnTest.java (original)
+++ zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ServerCnxnTest.java Fri Mar 14 23:10:35 2014
@@ -100,11 +100,7 @@ public class ServerCnxnTest extends Clie
reader =
new BufferedReader(
new InputStreamReader(sock.getInputStream()));
- StringBuilder sb = new StringBuilder();
- String line;
- while((line = reader.readLine()) != null) {
- sb.append(line + "\n");
- }
+ StringBuilder sb = readLine(reader);
return sb.toString();
} finally {
sock.close();
@@ -113,4 +109,21 @@ public class ServerCnxnTest extends Clie
}
}
}
+
+ private static StringBuilder readLine(BufferedReader reader) {
+ StringBuilder sb = new StringBuilder();
+ String line;
+ try {
+ while((line = reader.readLine()) != null) {
+ sb.append(line + "\n");
+ }
+ } catch (IOException ioe) {
+ // During connection expiry the server will close the connection.
+ // After the socket is closed, when the client tries to read a
+ // line of text it will throw java.net.SocketException.
+ // @see jira issue ZOOKEEPER-1862
+ LOG.info("Connnection is expired", ioe);
+ }
+ return sb;
+ }
}