mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Ludovic Poitou
09.09.2014 5e4d023e9667ac9e5c750beba869e2966d7c1310
frontport fix to OPENDJ-1268 to the opendj3-server-dev branch.
2 files modified
29 ■■■■ changed files
opendj3-server-dev/src/server/org/opends/server/types/HostPort.java 8 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/HostPortTest.java 21 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/types/HostPort.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2013 ForgeRock AS
 *      Portions Copyright 2013-2014 ForgeRock AS
 */
package org.opends.server.types;
@@ -260,7 +260,7 @@
              + hostPort + "'. The only allowed format for providing IPv6 "
              + "addresses is '[IPv6 address]:port'");
    }
    String host = sepIndex != -1 ? hostPort.substring(0, sepIndex) : hostPort;
    String host = hostPort.substring(0, sepIndex);
    int port = Integer.parseInt(hostPort.substring(sepIndex + 1));
    return new HostPort(host, port);
  }
@@ -426,7 +426,7 @@
      }
      return hostName + ":" + port;
    }
    return ":" + port;
    return WILDCARD_ADDRESS + ":" + port;
  }
  /**
@@ -510,8 +510,10 @@
    HostPort other = (HostPort) obj;
    if (normalizedHost == null)
    {
      if (other.normalizedHost != null)
        return false;
    }
    else if (!normalizedHost.equals(other.normalizedHost))
      return false;
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/HostPortTest.java
@@ -21,7 +21,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2013 ForgeRock AS
 *      Copyright 2013-2014 ForgeRock AS
 */
package org.opends.server.types;
@@ -142,4 +142,23 @@
    }
  }
  @Test
  public void allAddressesNullHost() {
    HostPort hp = HostPort.allAddresses(1);
    assertThat(hp.getHost()).isNull();
    assertThat(hp.getPort()).isEqualTo(1);
  }
  @Test
  public void allAddressesToString() {
    HostPort hp = HostPort.allAddresses(1636);
    assertThat(hp.toString()).isEqualTo(HostPort.WILDCARD_ADDRESS + ":1636");
  }
  @Test
  public void allAddressesEquals() {
    HostPort hp1 = HostPort.allAddresses(1389);
    HostPort hp2 = HostPort.allAddresses(1389);
    assertThat(hp1).isEqualTo(hp2);
  }
}