You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by ca...@apache.org on 2013/07/15 03:28:42 UTC

svn commit: r1503101 - /zookeeper/trunk/src/java/test/org/apache/zookeeper/server/util/PortForwarder.java

Author: camille
Date: Mon Jul 15 01:28:42 2013
New Revision: 1503101

URL: http://svn.apache.org/r1503101
Log:
ZOOKEEPER-1629. testTransactionLogCorruption occasionally fails. (shralex via camille)

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

Modified: zookeeper/trunk/src/java/test/org/apache/zookeeper/server/util/PortForwarder.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/util/PortForwarder.java?rev=1503101&r1=1503100&r2=1503101&view=diff
==============================================================================
--- zookeeper/trunk/src/java/test/org/apache/zookeeper/server/util/PortForwarder.java (original)
+++ zookeeper/trunk/src/java/test/org/apache/zookeeper/server/util/PortForwarder.java Mon Jul 15 01:28:42 2013
@@ -211,24 +211,26 @@ public class PortForwarder extends Threa
                             sock.getInputStream(), target.getOutputStream()));
                     this.workers.execute(new PortForwardWorker(target, sock,
                             target.getInputStream(), sock.getOutputStream()));
-                } catch (SocketTimeoutException e) {
-                    LOG.warn("socket timed out local:" + sock.getLocalPort()
-                            + " from:" + sock.getPort()
+                } catch (SocketTimeoutException e) {               	
+                    LOG.warn("socket timed out local:" 
+                            + (sock != null ? sock.getLocalPort(): "")
+                            + " from:" + (sock != null ? sock.getPort(): "")
                             + " to:" + to, e);
                 } catch (ConnectException e) {
-                    LOG.warn("connection exception local:" + sock.getLocalPort()
-                            + " from:" + sock.getPort()
+                    LOG.warn("connection exception local:"
+                            + (sock != null ? sock.getLocalPort(): "")
+                            + " from:" + (sock != null ? sock.getPort(): "")
                             + " to:" + to, e);
                     sock.close();
                 } catch (IOException e) {
                     if (!"Socket closed".equals(e.getMessage())) {
-                        LOG.warn("unexpected exception local:" + sock.getLocalPort()
-                            + " from:" + sock.getPort()
-                            + " to:" + to, e);
+                        LOG.warn("unexpected exception local:" 
+                        		+ (sock != null ? sock.getLocalPort(): "")
+                                + " from:" + (sock != null ? sock.getPort(): "")
+                                + " to:" + to, e);
                         throw e;
                     }
                 }
-
             }
         } catch (IOException e) {
             LOG.error("Unexpected exception to:" + to, e);