From a9ba1c2545ef442f76928469a424a6521cfa4725 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Sun, 26 Aug 2007 17:43:55 +0000
Subject: [PATCH] Fix for issues 2104 and 2162.

---
 opendj-sdk/opends/src/ads/org/opends/admin/ads/util/ConnectionUtils.java |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/src/ads/org/opends/admin/ads/util/ConnectionUtils.java b/opendj-sdk/opends/src/ads/org/opends/admin/ads/util/ConnectionUtils.java
index 57dd0e7..f6cc9eb 100644
--- a/opendj-sdk/opends/src/ads/org/opends/admin/ads/util/ConnectionUtils.java
+++ b/opendj-sdk/opends/src/ads/org/opends/admin/ads/util/ConnectionUtils.java
@@ -703,6 +703,28 @@
   }
 
   /**
+   * Returns the LDAP URL for the provided parameters.
+   * @param host the host name.
+   * @param port the LDAP port.
+   * @param useSSL whether to use SSL or not.
+   * @return the LDAP URL for the provided parameters.
+   */
+  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;
+  }
+
+  /**
    * Tells whether the provided Throwable was caused because of a problem with
    * a certificate while trying to establish a connection.
    * @param t the Throwable to analyze.

--
Gitblit v1.10.0