From 97f7d39cf58d120fc84c99c20bdb36ae35476ab3 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 04 Apr 2016 13:38:35 +0000
Subject: [PATCH] Use HostPort throughout
---
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/LDAPConnectionPool.java | 30 ++++++++++++------------------
1 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/LDAPConnectionPool.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/LDAPConnectionPool.java
index aa2c966..1e988e7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/LDAPConnectionPool.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/LDAPConnectionPool.java
@@ -28,6 +28,7 @@
import org.opends.admin.ads.util.ConnectionUtils;
import org.opends.guitools.controlpanel.event.ReferralAuthenticationListener;
import org.forgerock.opendj.ldap.DN;
+import org.opends.server.types.HostPort;
import org.opends.server.types.LDAPURL;
import org.forgerock.opendj.ldap.SearchScope;
@@ -84,9 +85,10 @@
for (String key : connectionTable.keySet())
{
ConnectionRecord cr = connectionTable.get(key);
+ HostPort hostPort = getHostPort(ctx);
+ HostPort crHostPort = getHostPort(cr.ctx);
if (cr.ctx != null
- && getHostName(cr.ctx).equals(getHostName(ctx))
- && getPort(cr.ctx) == getPort(ctx)
+ && hostPort.equals(crHostPort)
&& getBindDN(cr.ctx).equals(getBindDN(ctx))
&& getBindPassword(cr.ctx).equals(getBindPassword(ctx))
&& isSSL(cr.ctx) == isSSL(ctx)
@@ -389,7 +391,7 @@
*/
private static String makeKeyFromRecord(ConnectionRecord rec) {
String protocol = ConnectionUtils.isSSL(rec.ctx) ? "LDAPS" : "LDAP";
- return protocol + ":" + getHostName(rec.ctx) + ":" + getPort(rec.ctx);
+ return protocol + ":" + getHostPort(rec.ctx);
}
/**
@@ -476,18 +478,9 @@
}
private LDAPURL makeLDAPUrl(InitialLdapContext ctx) {
- return new LDAPURL(
- isSSL(ctx) ? "ldaps" : LDAPURL.DEFAULT_SCHEME,
- getHostName(ctx),
- getPort(ctx),
- "",
- null, // no attributes
- SearchScope.BASE_OBJECT,
- null, // No filter
- null); // No extensions
+ return makeLDAPUrl(ctx, "");
}
-
/**
* Make an url from the specified arguments.
* @param ctx the connection to the server.
@@ -495,15 +488,16 @@
* @return an LDAP URL from the specified arguments.
*/
public static LDAPURL makeLDAPUrl(InitialLdapContext ctx, String dn) {
+ HostPort hostPort = ConnectionUtils.getHostPort(ctx);
return new LDAPURL(
- ConnectionUtils.isSSL(ctx) ? "ldaps" : LDAPURL.DEFAULT_SCHEME,
- ConnectionUtils.getHostName(ctx),
- ConnectionUtils.getPort(ctx),
+ isSSL(ctx) ? "ldaps" : LDAPURL.DEFAULT_SCHEME,
+ hostPort.getHost(),
+ hostPort.getPort(),
dn,
null, // No attributes
SearchScope.BASE_OBJECT,
- null,
- null); // No filter
+ null, // No filter
+ null); // No extensions
}
--
Gitblit v1.10.0