Github user grkvlt commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/407#discussion_r22049789
  
    --- Diff: utils/common/src/main/java/brooklyn/util/net/Networking.java ---
    @@ -148,7 +158,11 @@ public static boolean isPortAvailable(InetAddress 
localAddress, int port) {
         }
         /** returns the first port available on the local machine >= the port 
supplied */
         public static int nextAvailablePort(int port) {
    -        while (!isPortAvailable(port)) 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)
    --- End diff --
    
    Should be `>` I think, as we _could_ have found port 65535 was available.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to