commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r999014 - /commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RCommandClient.java
Date Mon, 20 Sep 2010 17:21:01 GMT
Author: sebb
Date: Mon Sep 20 17:21:00 2010
New Revision: 999014

URL: http://svn.apache.org/viewvc?rev=999014&view=rev
Log:
Simplify loop, and avoid potential NPE warning

Modified:
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RCommandClient.java

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RCommandClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RCommandClient.java?rev=999014&r1=999013&r2=999014&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RCommandClient.java
(original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RCommandClient.java
Mon Sep 20 17:21:00 2010
@@ -124,16 +124,17 @@ public class RCommandClient extends RExe
             {
                 server = _serverSocketFactory_.createServerSocket(localPort, 1,
                          getLocalAddress());
+                break; // got a socket
             }
             catch (SocketException e)
             {
                 continue;
             }
-            break;
         }
 
-        if (localPort < MIN_CLIENT_PORT)
+        if (server == null) {
             throw new BindException("All ports in use.");
+        }
 
         _output_.write(Integer.toString(server.getLocalPort()).getBytes());
         _output_.write('\0');



Mime
View raw message