You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Youngjoon Kim (JIRA)" <ji...@apache.org> on 2015/11/07 01:24:11 UTC

[jira] [Created] (HBASE-14784) Port conflict is not resolved in HBaseTestingUtility.randomFreePort()

Youngjoon Kim created HBASE-14784:
-------------------------------------

             Summary: Port conflict is not resolved in HBaseTestingUtility.randomFreePort()
                 Key: HBASE-14784
                 URL: https://issues.apache.org/jira/browse/HBASE-14784
             Project: HBase
          Issue Type: Bug
          Components: test
    Affects Versions: 1.1.2
            Reporter: Youngjoon Kim
            Assignee: Youngjoon Kim
            Priority: Minor


If takenRandomPorts.contains(port) == true, it means port conflict, so randomFreePort() should rerun the loop. But continue statement leads to exit the loop, because port != 0.

{code:title=hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java}
public static int randomFreePort() {
  int port = 0; 
  do { 
    port = randomPort();
    if (takenRandomPorts.contains(port)) {
      continue;
    }    
    takenRandomPorts.add(port);

    ...

  } while (port == 0);
  return port;
}
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)