From 83ae76453e0b08ead8c12bd71c85445bdbbdb590 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 03 Aug 2016 16:05:42 +0000
Subject: [PATCH] Avoid DN being shown twice on UI: dc=example,dc=com,dc=example,dc=com

---
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeRefresher.java |   49 +++----------------------------------------------
 1 files changed, 3 insertions(+), 46 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeRefresher.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeRefresher.java
index 6fe7815..e2de5f8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeRefresher.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeRefresher.java
@@ -510,16 +510,10 @@
           while (sr.hasNext())
           {
             entry = sr.readEntry();
-            String name;
             if (entry.getName().isRootDN())
             {
-              name = remoteDn;
+              entry.setName(remoteDn);
             }
-            else
-            {
-              name = unquoteRelativeName(entry.getName().toString()) + "," + remoteDn;
-            }
-            entry.setName(name);
             found = true;
           }
           if (!found)
@@ -728,23 +722,13 @@
             continue;
           }
 
-          String name = unquoteRelativeName(r.getName().toString()) + "," + parentDn;
           boolean add = false;
           if (useCustomFilter())
           {
             // Check that is an immediate child: use a faster method by just
             // comparing the number of components.
-            DN dn = null;
-            try
-            {
-              dn = DN.valueOf(name);
-              add = dn.size() == parentComponents + 1;
-            }
-            catch (Throwable t)
-            {
-              throw new RuntimeException("Error decoding dns: "+t, t);
-            }
-
+            final DN dn = r.getName();
+            add = dn.size() == parentComponents + 1;
             if (!add)
             {
               // Is not a direct child.  Check if the parent has been added,
@@ -766,7 +750,6 @@
           }
           if (add)
           {
-            r.setName(name);
             childEntries.add(r);
             // Time to time we update the display
             if (childEntries.size() >= 20) {
@@ -914,32 +897,6 @@
     }
   }
 
-  /**
-   * Removes the quotes surrounding the provided name.  JNDI can return relative
-   * names with this format.
-   * @param name the relative name to be treated.
-   * @return an String representing the provided relative name without
-   * surrounding quotes.
-   */
-  private String unquoteRelativeName(String name)
-  {
-    if (name.length() > 0 && name.charAt(0) == '"')
-    {
-      if (name.charAt(name.length() - 1) == '"')
-      {
-        return name.substring(1, name.length() - 1);
-      }
-      else
-      {
-        return name.substring(1);
-      }
-    }
-    else
-    {
-      return name;
-    }
-  }
-
   /** DEBUG : Dump the state of the task. */
   void dump() {
     System.out.println("=============");

--
Gitblit v1.10.0