brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [05/22] incubator-brooklyn git commit: Fixed off by one error. After MAX_PORT_NUMBER comparison port is incremented and checked. If not in valid range isPortAvailable throws an exception which is less descriptive than the one in nextAvailablePort.
Date Mon, 09 Feb 2015 15:36:24 GMT
Fixed off by one error. After MAX_PORT_NUMBER comparison port is incremented and checked. If
not in valid range isPortAvailable throws an exception which is less descriptive than the
one in nextAvailablePort.


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/f673e199
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/f673e199
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/f673e199

Branch: refs/heads/master
Commit: f673e19910eaf160b2ba1c93e0d6a0d23a265f27
Parents: 34439f4
Author: Matt Champion <mattunderscorechampion@gmail.com>
Authored: Tue Jan 27 20:58:43 2015 +0000
Committer: Matt Champion <mattunderscorechampion@gmail.com>
Committed: Tue Jan 27 20:58:43 2015 +0000

----------------------------------------------------------------------
 utils/common/src/main/java/brooklyn/util/net/Networking.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/f673e199/utils/common/src/main/java/brooklyn/util/net/Networking.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/brooklyn/util/net/Networking.java b/utils/common/src/main/java/brooklyn/util/net/Networking.java
index 828bb46..7a7368c 100644
--- a/utils/common/src/main/java/brooklyn/util/net/Networking.java
+++ b/utils/common/src/main/java/brooklyn/util/net/Networking.java
@@ -151,8 +151,8 @@ public class Networking {
     public static int nextAvailablePort(int port) {
         checkArgument(port >= MIN_PORT_NUMBER && port <= MAX_PORT_NUMBER, "requested
port %s is outside the valid range of %s to %s", port, MIN_PORT_NUMBER, MAX_PORT_NUMBER);
         int originalPort = port;
-        while (!isPortAvailable(port) && port <= MAX_PORT_NUMBER) port++;
-        if (port > MAX_PORT_NUMBER)
+        while (!isPortAvailable(port) && port < MAX_PORT_NUMBER) port++;
+        if (port >= MAX_PORT_NUMBER)
             throw new RuntimeException("unable to find a free port at or above " + originalPort);
         return port;
     }


Mime
View raw message