From 867e35d3947bd5f2e6c0baaf502312ca618a00ea Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 05 Aug 2016 18:35:35 +0000
Subject: [PATCH] Partial OPENDJ-2625 Convert all code that uses JNDI to use the SDK instead

---
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java |   32 ++++++--------------------------
 1 files changed, 6 insertions(+), 26 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java
index a6919e0..75a575f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java
@@ -41,9 +41,7 @@
 import org.opends.guitools.controlpanel.util.Utilities;
 import org.opends.server.types.LDIFImportConfig;
 import org.opends.server.types.OpenDsException;
-import org.opends.server.util.Base64;
 import org.opends.server.util.LDIFReader;
-import org.opends.server.util.StaticUtils;
 
 /** The panel displaying an LDIF view of an entry. */
 public class LDIFViewEntryPanel extends ViewEntryPanel
@@ -290,35 +288,17 @@
   /**
    * Returns the equivalent LDIF line for a given attribute and value.
    * @param attrName the attribute name.
-   * @param o the value.
+   * @param value the value.
    * @return the equivalent LDIF line for the provided attribute and value.
    */
-  private String getLDIFLine(String attrName, Object o)
+  private String getLDIFLine(String attrName, ByteString value)
   {
-    String attrValue;
-    if (o instanceof String)
+    String v = value.toString();
+    if (isBinary(attrName) || Utilities.hasControlCharaters(v))
     {
-      if (Utilities.hasControlCharaters((String)o))
-      {
-        attrValue = Base64.encode(StaticUtils.getBytes((String)o));
-        attrName = attrName+":";
-      }
-      else
-      {
-        attrValue = (String)o;
-      }
-    }
-    else if (o instanceof byte[])
-    {
-      attrValue = Base64.encode((byte[])o);
       // To indicate that is base64 encoded
-      attrName = attrName+":";
+      return attrName + ":: " + value.toBase64String();
     }
-    else
-    {
-      attrValue = String.valueOf(o);
-    }
-
-    return attrName+": "+ attrValue;
+    return attrName + ": " + v;
   }
 }

--
Gitblit v1.10.0