From f298aaee8802d3eaad4ff712ed088546586388d8 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 24 Oct 2014 09:47:16 +0000
Subject: [PATCH] More code cleanup of ReplicationCliMain Removed utility methods that are just forwarding to other utility methods. Removed methods that have been ported to com.forgerock.opendj.cli.Utils.
---
opendj3-server-dev/src/ads/org/opends/admin/ads/util/ConnectionUtils.java | 44 ++++----------------------------------------
1 files changed, 4 insertions(+), 40 deletions(-)
diff --git a/opendj3-server-dev/src/ads/org/opends/admin/ads/util/ConnectionUtils.java b/opendj3-server-dev/src/ads/org/opends/admin/ads/util/ConnectionUtils.java
index c3c3a69..b77aefa 100644
--- a/opendj3-server-dev/src/ads/org/opends/admin/ads/util/ConnectionUtils.java
+++ b/opendj3-server-dev/src/ads/org/opends/admin/ads/util/ConnectionUtils.java
@@ -55,6 +55,8 @@
import org.opends.server.replication.plugin.EntryHistorical;
import org.opends.server.schema.SchemaConstants;
+import com.forgerock.opendj.cli.Utils;
+
/**
* Class providing some utilities to create LDAP connections using JNDI and
* to manage entries retrieved using JNDI.
@@ -745,35 +747,6 @@
}
/**
- * Returns the String that can be used to represent a given host name in a
- * LDAP URL. This method must be used when we have IPv6 addresses (the address
- * in the LDAP URL must be enclosed with brackets).
- *
- * @param host
- * The host name.
- * @return The String that can be used to represent a given host name in a
- * LDAP URL.
- */
- public static String getHostNameForLdapUrl(String host)
- {
- if ((host != null) && host.indexOf(":") != -1)
- {
- // Assume an IPv6 address has been specified and adds the brackets
- // for the URL.
- host = host.trim();
- if (!host.startsWith("["))
- {
- host = "[" + host;
- }
- if (!host.endsWith("]"))
- {
- host = host + "]";
- }
- }
- return host;
- }
-
- /**
* Returns the LDAP URL for the provided parameters.
* @param host the host name.
* @param port the LDAP port.
@@ -782,17 +755,8 @@
*/
public static String getLDAPUrl(String host, int port, boolean useSSL)
{
- String ldapUrl;
- host = getHostNameForLdapUrl(host);
- if (useSSL)
- {
- ldapUrl = "ldaps://"+host+":"+port;
- }
- else
- {
- ldapUrl = "ldap://"+host+":"+port;
- }
- return ldapUrl;
+ host = Utils.getHostNameForLdapUrl(host);
+ return (useSSL ? "ldaps://" : "ldap://") + host + ":" + port;
}
/**
--
Gitblit v1.10.0