From fbdb6aa2500f3004a3a3aa505d72e1e95492ebed Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 23 Mar 2009 10:51:25 +0000
Subject: [PATCH] Fix for issue 3890 (Control Panel LDAP browser displays 0.0.0.0 in the root entry)

---
 opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java
index eca6b6d..644c48a 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2008 Sun Microsystems, Inc.
+ *      Copyright 2008-2009 Sun Microsystems, Inc.
  */
 
 package org.opends.guitools.controlpanel.browser;
@@ -57,6 +57,7 @@
 
 import org.opends.admin.ads.ADSContext;
 import org.opends.admin.ads.util.ConnectionUtils;
+import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
 import org.opends.guitools.controlpanel.event.BrowserEvent;
 import org.opends.guitools.controlpanel.event.BrowserEventListener;
 import org.opends.guitools.controlpanel.event.ReferralAuthenticationListener;
@@ -174,14 +175,18 @@
    * Set the connection for accessing the directory.  Since we must use
    * different controls when searching the configuration and the user data,
    * two connections must be provided (this is done to avoid synchronization
-   * issues).
+   * issues).  We also pass the server descriptor corresponding to the
+   * connections to have a proper rendering of the root node.
+   * @param server the server descriptor.
    * @param ctxConfiguration the connection to be used to retrieve the data in
    * the configuration base DNs.
    * @param ctxUserData the connection to be used to retrieve the data in the
    * user base DNs.
    * @throws NamingException if an error occurs.
    */
-  public void setConnections(InitialLdapContext ctxConfiguration,
+  public void setConnections(
+      ServerDescriptor server,
+      InitialLdapContext ctxConfiguration,
       InitialLdapContext ctxUserData) throws NamingException {
     String rootNodeName;
     if (ctxConfiguration != null)
@@ -192,7 +197,7 @@
       this.ctxConfiguration.setRequestControls(
           getConfigurationRequestControls());
       this.ctxUserData.setRequestControls(getRequestControls());
-      rootNodeName = ConnectionUtils.getHostName(ctxConfiguration) + ":" +
+      rootNodeName = server.getHostname() + ":" +
       ConnectionUtils.getPort(ctxConfiguration);
     }
     else {

--
Gitblit v1.10.0