mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noël Rouvignac
04.47.2016 8ca638034127ea5c5911ebcd13ff33e742e06784
Partial OPENDJ-2625 Convert all code that uses JNDI to use the SDK instead

JNDI's SearchResult could hold values with different types, SDK's SearchResultEntry only knows ByteString
11 files modified
523 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/BrowserController.java 17 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java 25 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java 81 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DuplicateEntryPanel.java 21 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java 16 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java 17 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java 226 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java 13 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java 14 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java 83 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/BrowserController.java
@@ -48,6 +48,7 @@
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.responses.SearchResultEntry;
import org.opends.admin.ads.ADSContext;
@@ -1792,12 +1793,8 @@
   */
  private static int getNumSubOrdinates(CustomSearchResult entry)
  {
    List<Object> vs = entry.getAttributeValues(NUMSUBORDINATES_ATTR);
    String v = null;
    if (vs != null && !vs.isEmpty())
    {
      v = vs.get(0).toString();
    }
    List<ByteString> vs = entry.getAttributeValues(NUMSUBORDINATES_ATTR);
    String v = !vs.isEmpty() ? vs.get(0).toString() : null;
    return toInt(v);
  }
@@ -1827,12 +1824,8 @@
   */
  public static boolean getHasSubOrdinates(CustomSearchResult entry)
  {
    List<Object> vs = entry.getAttributeValues(HASSUBORDINATES_ATTR);
    String v = null;
    if (vs != null && !vs.isEmpty())
    {
      v = vs.get(0).toString();
    }
    List<ByteString> vs = entry.getAttributeValues(HASSUBORDINATES_ATTR);
    String v = !vs.isEmpty() ? vs.get(0).toString() : null;
    if (v != null)
    {
      return "true".equalsIgnoreCase(v);
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
@@ -47,7 +47,7 @@
public class CustomSearchResult implements Comparable<CustomSearchResult>
{
  private final DN dn;
  private Map<String, List<Object>> attributes;
  private Map<String, List<ByteString>> attributes;
  private SortedSet<String> attrNames;
  private String toString;
  private int hashCode;
@@ -82,7 +82,7 @@
    {
      String attrName = attr.getAttributeDescriptionAsString();
      attrNames.add(attrName);
      List<Object> values = new ArrayList<>();
      List<ByteString> values = new ArrayList<>();
      for (ByteString v : attr)
      {
        if (!"".equals(v.toString()))
@@ -112,9 +112,9 @@
   * @return the values for a given attribute.  It returns an empty Set if
   * the attribute is not defined.
   */
  public List<Object> getAttributeValues(String name) {
    List<Object> values = attributes.get(name.toLowerCase());
    return values != null ? values : Collections.emptyList();
  public List<ByteString> getAttributeValues(String name) {
    List<ByteString> values = attributes.get(name.toLowerCase());
    return values != null ? values : Collections.<ByteString> emptyList();
  }
  /**
@@ -178,7 +178,7 @@
   * @param attrName the name of the attribute.
   * @param values the values for the attribute.
   */
  public void set(String attrName, List<Object> values)
  public void set(String attrName, List<ByteString> values)
  {
    attrNames.add(attrName);
    attrName = attrName.toLowerCase();
@@ -219,7 +219,7 @@
      // corresponding definition and add the value to the appropriate hash.
      if (attrType.isObjectClass())
      {
        for (Object value : getAttributeValues(attrType.getNameOrOID()))
        for (ByteString value : getAttributeValues(attrType.getNameOrOID()))
        {
          String ocName = value.toString().trim();
          objectClasses.put(DirectoryServer.getSchema().getObjectClass(ocName), ocName);
@@ -228,17 +228,8 @@
      else
      {
        AttributeBuilder builder = new AttributeBuilder(attrDesc);
        for (Object value : getAttributeValues(attrType.getNameOrOID()))
        for (ByteString bs : getAttributeValues(attrType.getNameOrOID()))
        {
          ByteString bs;
          if (value instanceof byte[])
          {
            bs = ByteString.wrap((byte[])value);
          }
          else
          {
            bs = ByteString.valueOfUtf8(value.toString());
          }
          builder.add(bs);
        }
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
@@ -455,8 +455,7 @@
  {
    for (AVA ava : rdn)
    {
      List<Object> values = entry.getAttributeValues(ava.getAttributeName());
      if (values.isEmpty())
      if (entry.getAttributeValues(ava.getAttributeName()).isEmpty())
      {
        return false;
      }
@@ -492,7 +491,7 @@
      {
        newValues.add(it.next());
      }
      List<Object> oldValues = oldEntry.getAttributeValues(attrName);
      List<ByteString> oldValues = oldEntry.getAttributeValues(attrName);
      ByteString rdnValue = null;
      for (AVA ava : newEntry.getName().rdn())
@@ -549,12 +548,12 @@
              createAttribute(attrName, newValues)));
        }
      } else {
        List<ByteString> toDelete = getValuesToDelete(oldValues, newValues);
        List<ByteString> toDelete = disjunction(newValues, oldValues);
        if (oldRdnValueDeleted != null)
        {
          toDelete.remove(oldRdnValueDeleted);
        }
        List<ByteString> toAdd = getValuesToAdd(oldValues, newValues);
        List<ByteString> toAdd = disjunction(oldValues, newValues);
        if (oldRdnValueToAdd != null)
        {
          toAdd.add(oldRdnValueToAdd);
@@ -599,7 +598,7 @@
      {
        continue;
      }
      List<Object> oldValues = oldEntry.getAttributeValues(attrName);
      List<ByteString> oldValues = oldEntry.getAttributeValues(attrName);
      AttributeDescription attrDesc = AttributeDescription.valueOf(attrName);
      List<org.opends.server.types.Attribute> attrs = newEntry.getAttribute(attrDesc.getNameOrOID());
@@ -641,74 +640,16 @@
    return attribute;
  }
  /**
   * Creates a ByteString for an attribute and a value (the one we got using JNDI).
   * @param value the value found using JNDI.
   * @return a ByteString object.
   */
  private static ByteString createAttributeValue(Object value)
  private static List<ByteString> disjunction(List<ByteString> values2, List<ByteString> values1)
  {
    if (value instanceof String)
    List<ByteString> results = new ArrayList<>();
    for (ByteString v : values1)
    {
      return ByteString.valueOfUtf8((String) value);
    }
    else if (value instanceof byte[])
    {
      return ByteString.wrap((byte[]) value);
    }
    return ByteString.valueOfUtf8(String.valueOf(value));
  }
  /**
   * Returns the set of ByteString that must be deleted.
   * @param oldValues the old values of the entry.
   * @param newValues the new values of the entry.
   * @return the set of ByteString that must be deleted.
   */
  private static List<ByteString> getValuesToDelete(List<Object> oldValues,
      List<ByteString> newValues)
  {
    List<ByteString> valuesToDelete = new ArrayList<>();
    for (Object o : oldValues)
    {
      ByteString oldValue = createAttributeValue(o);
      if (!newValues.contains(oldValue))
      if (!values2.contains(v))
      {
        valuesToDelete.add(oldValue);
        results.add(v);
      }
    }
    return valuesToDelete;
  }
  /**
   * Returns the set of ByteString that must be added.
   * @param oldValues the old values of the entry.
   * @param newValues the new values of the entry.
   * @return the set of ByteString that must be added.
   */
  private static List<ByteString> getValuesToAdd(List<Object> oldValues,
    List<ByteString> newValues)
  {
    List<ByteString> valuesToAdd = new ArrayList<>();
    for (ByteString newValue : newValues)
    {
      if (!contains(oldValues, newValue))
      {
        valuesToAdd.add(newValue);
      }
    }
    return valuesToAdd;
  }
  private static boolean contains(List<Object> oldValues, ByteString newValue)
  {
    for (Object o : oldValues)
    {
      if (createAttributeValue(o).equals(newValue))
      {
        return true;
      }
    }
    return false;
    return results;
  }
}
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DuplicateEntryPanel.java
@@ -17,8 +17,10 @@
package org.opends.guitools.controlpanel.ui;
import static com.forgerock.opendj.cli.Utils.*;
import static org.opends.messages.AdminToolMessages.*;
import static com.forgerock.opendj.cli.Utils.isDN;
import static org.opends.server.util.ServerConstants.*;
import java.awt.Component;
import java.awt.GridBagConstraints;
@@ -37,6 +39,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.opends.admin.ads.util.ConnectionWrapper;
import org.opends.guitools.controlpanel.browser.BrowserController;
@@ -47,7 +50,6 @@
import org.opends.guitools.controlpanel.util.Utilities;
import org.opends.server.util.Base64;
import org.opends.server.util.LDIFException;
import org.opends.server.util.ServerConstants;
/** The panel used to duplicate an entry. */
public class DuplicateEntryPanel extends AbstractNewEntryPanel
@@ -344,8 +346,8 @@
    sb.append("dn: ").append(dn);
    for (String attrName : entryToDuplicate.getAttributeNames())
    {
      List<Object> values = entryToDuplicate.getAttributeValues(attrName);
      if (attrName.equalsIgnoreCase(ServerConstants.ATTR_USER_PASSWORD))
      List<ByteString> values = entryToDuplicate.getAttributeValues(attrName);
      if (attrName.equalsIgnoreCase(ATTR_USER_PASSWORD))
      {
        sb.append("\n");
        String pwd = new String(password.getPassword());
@@ -361,12 +363,12 @@
        {
          continue;
        }
        for (Object value : values)
        for (ByteString value : values)
        {
          sb.append("\n");
          if (value instanceof byte[])
          if (isBinary(attrName))
          {
            final String base64 = Base64.encode((byte[]) value);
            final String base64 = Base64.encode(value.toByteArray());
            sb.append(attrName).append(":: ").append(base64);
          }
          else
@@ -386,7 +388,7 @@
        else
        {
          String oldValue = getFirstValue(entryToDuplicate.getDN());
          for (Object value : values)
          for (ByteString value : values)
          {
            sb.append("\n");
            if (oldValue.equals(value))
@@ -470,8 +472,7 @@
            rdnAttribute = sr.getDN().rdn().getFirstAVA().getAttributeType().getNameOrOID();
            updateDNValue();
            Boolean hasPassword = !sr.getAttributeValues(
                    ServerConstants.ATTR_USER_PASSWORD).isEmpty();
            boolean hasPassword = !sr.getAttributeValues(ATTR_USER_PASSWORD).isEmpty();
            lPassword.setVisible(hasPassword);
            password.setVisible(hasPassword);
            lconfirmPassword.setVisible(hasPassword);
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java
@@ -34,6 +34,7 @@
import javax.swing.tree.TreePath;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
import org.opends.guitools.controlpanel.task.OfflineUpdateException;
import org.opends.guitools.controlpanel.util.Utilities;
@@ -168,10 +169,9 @@
      editableScroll.setVisible(false);
      for (String attrName : sr.getAttributeNames())
      {
        List<Object> values = sr.getAttributeValues(attrName);
        for (Object o : values)
        for (ByteString v : sr.getAttributeValues(attrName))
        {
          sb.append("\n").append(getLDIFLine(attrName, o));
          sb.append("\n").append(getLDIFLine(attrName, v));
        }
      }
      final Point p1 = sameEntry ?
@@ -187,10 +187,9 @@
      {
        if (!schemaReadOnlyAttributesLowerCase.contains(attrName.toLowerCase()))
        {
          List<Object> values = sr.getAttributeValues(attrName);
          for (Object o : values)
          for (ByteString v : sr.getAttributeValues(attrName))
          {
            sb.append("\n").append(getLDIFLine(attrName, o));
            sb.append("\n").append(getLDIFLine(attrName, v));
          }
        }
      }
@@ -206,15 +205,14 @@
      sb = new StringBuilder();
      for (String attrName : schemaReadOnlyAttributes)
      {
        List<Object> values = sr.getAttributeValues(attrName);
        for (Object o : values)
        for (ByteString v : sr.getAttributeValues(attrName))
        {
          if (oneLineAdded)
          {
            sb.append("\n");
          }
          oneLineAdded = true;
          sb.append(getLDIFLine(attrName, o));
          sb.append(getLDIFLine(attrName, v));
        }
      }
      final Point p2 = sameEntry ?
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
@@ -506,7 +506,7 @@
      };
      for (int j=0; j < attrNames.length; j++)
      {
        Object o = values[j] + r.nextInt();
        ByteString o = ByteString.valueOfUtf8(values[j] + r.nextInt());
        csr.set(attrNames[j], newArrayList(o));
      }
      try
@@ -571,7 +571,7 @@
      };
      for (int j=0; j < attrNames.length; j++)
      {
        Object o = values[j];
        ByteString o = ByteString.valueOfUtf8(values[j]);
        csr.set(attrNames[j], newArrayList(o));
      }
      try
@@ -646,7 +646,7 @@
      // corresponding definition and add the value to the appropriate hash.
      if (attrType.isObjectClass())
      {
        for (Object value : csr.getAttributeValues(attrType.getNameOrOID()))
        for (ByteString value : csr.getAttributeValues(attrType.getNameOrOID()))
        {
          String ocName = value.toString().trim();
          objectClasses.put(DirectoryServer.getSchema().getObjectClass(ocName), ocName);
@@ -655,17 +655,8 @@
      else
      {
        AttributeBuilder builder = new AttributeBuilder(attrDesc);
        for (Object value : csr.getAttributeValues(attrType.getNameOrOID()))
        for (ByteString bs : csr.getAttributeValues(attrType.getNameOrOID()))
        {
          ByteString bs;
          if (value instanceof byte[])
          {
            bs = ByteString.wrap((byte[])value);
          }
          else
          {
            bs = ByteString.valueOfUtf8(value.toString());
          }
          builder.add(bs);
        }
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
@@ -19,6 +19,8 @@
import static com.forgerock.opendj.cli.Utils.*;
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.opends.server.util.ServerConstants.*;
import java.awt.Component;
import java.awt.GridBagConstraints;
@@ -96,7 +98,6 @@
import org.opends.server.types.Schema;
import org.opends.server.util.Base64;
import org.opends.server.util.LDIFReader;
import org.opends.server.util.ServerConstants;
/** The panel displaying a simplified view of an entry. */
class SimplifiedViewEntryPanel extends ViewEntryPanel
@@ -144,9 +145,9 @@
  private static final Map<String, String[]> hmOrdereredAttrNames = new HashMap<>();
  static
  {
    hmFriendlyAttrNames.put(ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME,
    hmFriendlyAttrNames.put(OBJECTCLASS_ATTRIBUTE_TYPE_NAME,
        INFO_CTRL_PANEL_OBJECTCLASS_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_COMMON_NAME,
    hmFriendlyAttrNames.put(ATTR_COMMON_NAME,
        INFO_CTRL_PANEL_CN_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put("givenname",
        INFO_CTRL_PANEL_GIVENNAME_FRIENDLY_NAME.get());
@@ -184,13 +185,13 @@
        INFO_CTRL_PANEL_DESCRIPTION_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put("postaladdress",
        INFO_CTRL_PANEL_POSTALADDRESS_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_UNIQUE_MEMBER_LC,
    hmFriendlyAttrNames.put(ATTR_UNIQUE_MEMBER_LC,
        INFO_CTRL_PANEL_UNIQUEMEMBER_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_MEMBER,
    hmFriendlyAttrNames.put(ATTR_MEMBER,
        INFO_CTRL_PANEL_MEMBER_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_MEMBER_URL_LC,
    hmFriendlyAttrNames.put(ATTR_MEMBER_URL_LC,
        INFO_CTRL_PANEL_MEMBERURL_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_C,
    hmFriendlyAttrNames.put(ATTR_C,
        INFO_CTRL_PANEL_C_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put("ds-target-group-dn",
        INFO_CTRL_PANEL_DS_TARGET_GROUP_DN_FRIENDLY_NAME.get());
@@ -198,45 +199,43 @@
        INFO_CTRL_PANEL_USERCERTIFICATE_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put("jpegphoto",
        INFO_CTRL_PANEL_JPEGPHOTO_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_SUPPORTED_AUTH_PW_SCHEMES_LC,
    hmFriendlyAttrNames.put(ATTR_SUPPORTED_AUTH_PW_SCHEMES_LC,
        INFO_CTRL_PANEL_SUPPORTEDPWDSCHEMES_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_SUPPORTED_CONTROL_LC,
    hmFriendlyAttrNames.put(ATTR_SUPPORTED_CONTROL_LC,
        INFO_CTRL_PANEL_SUPPORTEDCONTROLS_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_SUPPORTED_LDAP_VERSION_LC,
    hmFriendlyAttrNames.put(ATTR_SUPPORTED_LDAP_VERSION_LC,
        INFO_CTRL_PANEL_SUPPORTEDLDAPVERSIONS_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_SUPPORTED_CONTROL_LC,
    hmFriendlyAttrNames.put(ATTR_SUPPORTED_CONTROL_LC,
        INFO_CTRL_PANEL_SUPPORTEDCONTROLS_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_SUPPORTED_EXTENSION_LC,
    hmFriendlyAttrNames.put(ATTR_SUPPORTED_EXTENSION_LC,
        INFO_CTRL_PANEL_SUPPORTEDEXTENSIONS_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_SUPPORTED_FEATURE_LC,
    hmFriendlyAttrNames.put(ATTR_SUPPORTED_FEATURE_LC,
        INFO_CTRL_PANEL_SUPPORTEDFEATURES_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_VENDOR_NAME_LC,
    hmFriendlyAttrNames.put(ATTR_VENDOR_NAME_LC,
        INFO_CTRL_PANEL_VENDORNAME_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_VENDOR_VERSION_LC,
    hmFriendlyAttrNames.put(ATTR_VENDOR_VERSION_LC,
        INFO_CTRL_PANEL_VENDORVERSION_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_NAMING_CONTEXTS_LC,
    hmFriendlyAttrNames.put(ATTR_NAMING_CONTEXTS_LC,
        INFO_CTRL_PANEL_NAMINGCONTEXTS_FRIENDLY_NAME.get());
    hmFriendlyAttrNames.put(ServerConstants.ATTR_PRIVATE_NAMING_CONTEXTS,
    hmFriendlyAttrNames.put(ATTR_PRIVATE_NAMING_CONTEXTS,
        INFO_CTRL_PANEL_PRIVATENAMINGCONTEXTS_FRIENDLY_NAME.get());
    hmNameAttrNames.put("organizationalunit", ServerConstants.ATTR_OU);
    hmNameAttrNames.put("domain", ServerConstants.ATTR_DC);
    hmNameAttrNames.put("organization", ServerConstants.ATTR_O);
    hmNameAttrNames.put(ServerConstants.OC_GROUP_OF_URLS_LC,
        ServerConstants.ATTR_COMMON_NAME);
    hmNameAttrNames.put(ServerConstants.OC_GROUP_OF_NAMES_LC,
        ServerConstants.ATTR_COMMON_NAME);
    hmNameAttrNames.put("organizationalunit", ATTR_OU);
    hmNameAttrNames.put("domain", ATTR_DC);
    hmNameAttrNames.put("organization", ATTR_O);
    hmNameAttrNames.put(OC_GROUP_OF_URLS_LC, ATTR_COMMON_NAME);
    hmNameAttrNames.put(OC_GROUP_OF_NAMES_LC, ATTR_COMMON_NAME);
    hmOrdereredAttrNames.put("person",
        new String[]{"givenname", "sn", ServerConstants.ATTR_COMMON_NAME, "uid",
        new String[]{"givenname", "sn", ATTR_COMMON_NAME, "uid",
        "userpassword", "mail", "telephonenumber", "facsimiletelephonenumber",
        "employeenumber", "street", "l", "st", "postalcode", "mobile",
        "homephone", "pager", "description", "postaladdress"});
    hmOrdereredAttrNames.put(ServerConstants.OC_GROUP_OF_NAMES_LC,
    hmOrdereredAttrNames.put(OC_GROUP_OF_NAMES_LC,
        new String[]{"cn", "description",
        ServerConstants.ATTR_UNIQUE_MEMBER_LC, "ds-target-group-dn"});
    hmOrdereredAttrNames.put(ServerConstants.OC_GROUP_OF_URLS_LC,
        new String[]{"cn", "description", ServerConstants.ATTR_MEMBER_URL_LC});
        ATTR_UNIQUE_MEMBER_LC, "ds-target-group-dn"});
    hmOrdereredAttrNames.put(OC_GROUP_OF_URLS_LC,
        new String[]{"cn", "description", ATTR_MEMBER_URL_LC});
    hmOrdereredAttrNames.put("organizationalunit",
        new String[]{"ou", "description", "postalAddress", "telephonenumber",
    "facsimiletelephonenumber"});
@@ -440,11 +439,11 @@
    Collection<String> sortedAttributes = getSortedAttributes(sr, isReadOnly);
    if (isReadOnly)
    {
      for (String attr : sortedAttributes)
      for (String attrName : sortedAttributes)
      {
        JLabel label = getLabelForAttribute(attr, sr);
        List<Object> values = sr.getAttributeValues(attr);
        JComponent comp = getReadOnlyComponent(attr, values);
        JLabel label = getLabelForAttribute(attrName, sr);
        List<ByteString> values = sr.getAttributeValues(attrName);
        JComponent comp = getReadOnlyComponent(attrName, values);
        gbc.weightx = 0.0;
        gbc.anchor = anchor1(values);
        gbc.insets.left = 0;
@@ -459,43 +458,35 @@
    }
    else
    {
      for (final String attr : sortedAttributes)
      for (final String attrName : sortedAttributes)
      {
        String lcAttr = attr.toLowerCase();
        JLabel label = getLabelForAttribute(attr, sr);
        if (isRequired(attr, sr))
        String lcAttr = attrName.toLowerCase();
        JLabel label = getLabelForAttribute(attrName, sr);
        if (isRequired(attrName, sr))
        {
          Utilities.setRequiredIcon(label);
          requiredAttrs.add(lcAttr);
        }
        List<Object> values = sr.getAttributeValues(attr);
        List<ByteString> values = sr.getAttributeValues(attrName);
        if (values.isEmpty())
        {
          values = new ArrayList<>(1);
          if (isBinary(attr))
          {
            values.add(new byte[]{});
          }
          else
          {
            values.add("");
          }
          values = newArrayList(ByteString.empty());
        }
        final boolean isPasswordAttr = isPassword(attr);
        final boolean isPasswordAttr = isPassword(attrName);
        if (isPasswordAttr)
        {
          List<String> pwds = new ArrayList<>();
          for (Object o : values)
          for (ByteString v : values)
          {
            pwds.add(getPasswordStringValue(o));
            pwds.add(getPasswordStringValue(attrName, v));
          }
          lastUserPasswords.put(lcAttr, pwds);
        }
        JComponent comp = getReadWriteComponent(attr, values);
        JComponent comp = getReadWriteComponent(attrName, values);
        gbc.weightx = 0.0;
        gbc.anchor = anchor2(attr, values);
        gbc.anchor = anchor2(attrName, values);
        gbc.insets.left = 0;
        gbc.gridwidth = GridBagConstraints.RELATIVE;
        attributesPanel.add(label, gbc);
@@ -511,14 +502,14 @@
        {
          label = Utilities.createPrimaryLabel(
              INFO_CTRL_PANEL_PASSWORD_CONFIRM_LABEL.get());
          String key = getConfirmPasswordKey(attr);
          String key = getConfirmPasswordKey(attrName);
          comp = getReadWriteComponent(key, values);
          hmLabels.put(key, label);
          hmComponents.put(key, comp);
          gbc.weightx = 0.0;
          gbc.anchor = isSingleValue(attr) ? GridBagConstraints.WEST : GridBagConstraints.NORTHWEST;
          gbc.anchor = isSingleValue(attrName) ? GridBagConstraints.WEST : GridBagConstraints.NORTHWEST;
          gbc.insets.left = 0;
          gbc.gridwidth = GridBagConstraints.RELATIVE;
          attributesPanel.add(label, gbc);
@@ -560,14 +551,14 @@
    });
  }
  private int anchor2(final String attr, List<Object> values)
  private int anchor2(final String attr, List<ByteString> values)
  {
    if (ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME.equalsIgnoreCase(attr))
    if (OBJECTCLASS_ATTRIBUTE_TYPE_NAME.equalsIgnoreCase(attr))
    {
      int nOcs = 0;
      for (Object o : values)
      for (ByteString v : values)
      {
        if (!"top".equals(o))
        if (!"top".equals(v))
        {
          nOcs++;
        }
@@ -578,7 +569,7 @@
    {
      return GridBagConstraints.WEST;
    }
    else if (values.size() <= 1 && (hasBinaryValue(values) || isBinary(attr)))
    else if (values.size() <= 1 && isBinary(attr))
    {
      return GridBagConstraints.WEST;
    }
@@ -588,7 +579,7 @@
    }
  }
  private int anchor1(List<Object> values)
  private int anchor1(List<ByteString> values)
  {
    int size = values.size();
    if (size > 1)
@@ -597,8 +588,8 @@
    }
    else if (size == 1)
    {
      Object v = values.get(0);
      if (v instanceof String && ((String) v).contains("\n"))
      ByteString v = values.get(0);
      if (v.toString().contains("\n"))
      {
        return GridBagConstraints.NORTHWEST;
      }
@@ -672,10 +663,10 @@
    // Put first the attributes associated with the objectclass in hmOrderedAttrNames
    LinkedHashSet<String> attrNames = new LinkedHashSet<>();
    List<Object> values = sr.getAttributeValues(ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
    for (Object o : values)
    List<ByteString> values = sr.getAttributeValues(OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
    for (ByteString oc : values)
    {
      String ocName = (String)o;
      String ocName = oc.toString();
      String[] attrs = hmOrdereredAttrNames.get(ocName.toLowerCase());
      if (attrs != null)
      {
@@ -714,11 +705,10 @@
      if (schema != null)
      {
        List<Object> ocs = sr.getAttributeValues(
            ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
        for (Object oc : ocs)
        List<ByteString> ocs = sr.getAttributeValues(OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
        for (ByteString oc : ocs)
        {
          ObjectClass objectClass = schema.getObjectClass((String) oc);
          ObjectClass objectClass = schema.getObjectClass(oc.toString());
          if (!objectClass.isPlaceHolder())
          {
            for (AttributeType attr : objectClass.getRequiredAttributes())
@@ -816,37 +806,34 @@
    return isCertificate;
  }
  private JComponent getReadOnlyComponent(final String attrName, List<Object> values)
  private JComponent getReadOnlyComponent(final String attrName, List<ByteString> values)
  {
//  GridLayout is used to avoid the 512 limit of GridBagLayout
    // GridLayout is used to avoid the 512 limit of GridBagLayout
    JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque(false);
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridy = 0;
    boolean isBinary = hasBinaryValue(values);
    for (Object o : values)
    final Schema schema = getInfo().getServerDescriptor().getSchema();
    boolean isBinary = isBinary(attrName);
    for (ByteString v : values)
    {
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.weightx = 1.0;
      gbc.gridx = 0;
      if (ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME.equalsIgnoreCase(attrName))
      if (OBJECTCLASS_ATTRIBUTE_TYPE_NAME.equalsIgnoreCase(attrName))
      {
        ObjectClassCellPanel ocPanel = new ObjectClassCellPanel();
        Schema schema = getInfo().getServerDescriptor().getSchema();
        if (schema != null)
        {
          ObjectClassValue ocDescriptor = getObjectClassDescriptor(values,
              schema);
          ocPanel.setValue(ocDescriptor);
          ocPanel.setValue(getObjectClassDescriptor(values, schema));
        }
        ocPanel.setEditButtonVisible(false);
        panel.add(ocPanel, gbc);
        break;
      }
      else if (Utilities.mustObfuscate(attrName,
          getInfo().getServerDescriptor().getSchema()))
      else if (Utilities.mustObfuscate(attrName, schema))
      {
        panel.add(
            Utilities.createDefaultLabel(
@@ -875,8 +862,7 @@
      {
        final BinaryCellPanel pane = new BinaryCellPanel();
        pane.setEditButtonText(INFO_CTRL_PANEL_VIEW_BUTTON_LABEL.get());
        final byte[] binaryValue = (byte[])o;
        Schema schema = getInfo().getServerDescriptor().getSchema();
        final byte[] binaryValue = v.toByteArray();
        final boolean isImage = Utilities.hasImageSyntax(attrName, schema);
        pane.setValue(binaryValue, isImage);
        pane.addEditActionListener(new ActionListener()
@@ -905,18 +891,17 @@
    return panel;
  }
  private Set<String> toStrings(Collection<Object> objects)
  private Set<String> toStrings(Collection<ByteString> objects)
  {
    Set<String> results = new TreeSet<>();
    for (Object o : objects)
    for (ByteString o : objects)
    {
      results.add(String.valueOf(o));
      results.add(o.toString());
    }
    return results;
  }
  private JComponent getReadWriteComponent(final String attrName,
      List<Object> values)
  private JComponent getReadWriteComponent(final String attrName, List<ByteString> values)
  {
    JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque(false);
@@ -926,16 +911,16 @@
    List<EditorComponent> components = new ArrayList<>();
    hmEditors.put(attrName.toLowerCase(), components);
    boolean isBinary = hasBinaryValue(values);
    for (Object o : values)
    final Schema schema = getInfo().getServerDescriptor().getSchema();
    boolean isBinary = isBinary(attrName);
    for (ByteString v : values)
    {
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.weightx = 1.0;
      gbc.gridx = 0;
      if (ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME.equalsIgnoreCase(attrName))
      if (OBJECTCLASS_ATTRIBUTE_TYPE_NAME.equalsIgnoreCase(attrName))
      {
        final ObjectClassCellPanel ocCellPanel = new ObjectClassCellPanel();
        Schema schema = getInfo().getServerDescriptor().getSchema();
        final ObjectClassValue ocDescriptor;
        if (schema != null)
        {
@@ -987,9 +972,9 @@
      else if (isPassword(attrName) || isConfirmPassword(attrName))
      {
        JPasswordField pf = Utilities.createPasswordField();
        if (!"".equals(o))
        if (!"".equals(v))
        {
          pf.setText(getPasswordStringValue(o));
          pf.setText(getPasswordStringValue(attrName, v));
        }
        panel.add(pf, gbc);
        components.add(new EditorComponent(pf));
@@ -999,7 +984,7 @@
        if (isSingleValue(attrName))
        {
          final JTextField tf = Utilities.createMediumTextField();
          tf.setText(String.valueOf(o));
          tf.setText(String.valueOf(v));
          gbc.gridx = 0;
          panel.add(tf, gbc);
          if (mustAddBrowseButton(attrName))
@@ -1041,10 +1026,9 @@
            final JButton browse = Utilities.createButton(
                INFO_CTRL_PANEL_BROWSE_BUTTON_LABEL.get());
            browse.addActionListener(new AddBrowseClickedActionListener(ta, attrName));
            if (ServerConstants.ATTR_UNIQUE_MEMBER_LC.equalsIgnoreCase(attrName))
            if (ATTR_UNIQUE_MEMBER_LC.equalsIgnoreCase(attrName))
            {
              browse.setText(
                  INFO_CTRL_PANEL_ADD_MEMBERS_BUTTON.get().toString());
              browse.setText(INFO_CTRL_PANEL_ADD_MEMBERS_BUTTON.get().toString());
            }
            panel.add(browse, gbc);
            new DropTarget(ta, dropTargetListener);
@@ -1056,10 +1040,9 @@
      else
      {
        final BinaryCellPanel pane = new BinaryCellPanel();
        Schema schema = getInfo().getServerDescriptor().getSchema();
        final boolean isImage = Utilities.hasImageSyntax(attrName, schema);
        pane.setDisplayDelete(true);
        final byte[] binaryValue = (byte[])o;
        final byte[] binaryValue = v.toByteArray();
        if (binaryValue.length > 0)
        {
          pane.setValue(binaryValue, isImage);
@@ -1151,10 +1134,10 @@
      AttributeType attrType = attrDesc.getAttributeType();
      if (!attrType.isPlaceHolder())
      {
        List<Object> ocs = sr.getAttributeValues(ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
        for (Object oc : ocs)
        List<ByteString> ocs = sr.getAttributeValues(OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
        for (ByteString oc : ocs)
        {
          ObjectClass objectClass = schema.getObjectClass(((String) oc));
          ObjectClass objectClass = schema.getObjectClass(oc.toString());
          if (!objectClass.isPlaceHolder() && objectClass.isRequired(attrType))
          {
            return true;
@@ -1312,7 +1295,7 @@
        List<String> newPwds = getNewPasswords(attrName);
        if (newPwds.equals(lastUserPasswords.get(attrName.toLowerCase())))
        {
          List<Object> oldValues = searchResult.getAttributeValues(attrName);
          List<ByteString> oldValues = searchResult.getAttributeValues(attrName);
          if (!oldValues.isEmpty())
          {
            appendLDIFLines(sb, attrName, oldValues);
@@ -1333,7 +1316,7 @@
    // Add the attributes that are not displayed
    for (String attrName : schemaReadOnlyAttributesLowerCase)
    {
      List<Object> values = searchResult.getAttributeValues(attrName);
      List<ByteString> values = searchResult.getAttributeValues(attrName);
      if (!values.isEmpty())
      {
        appendLDIFLines(sb, attrName, values);
@@ -1344,10 +1327,9 @@
  private boolean isAttrName(String attrName, CustomSearchResult sr)
  {
    List<Object> values = sr.getAttributeValues(ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
    for (Object o : values)
    for (ByteString v : sr.getAttributeValues(OBJECTCLASS_ATTRIBUTE_TYPE_NAME))
    {
      String ocName = (String)o;
      String ocName = v.toString();
      String attr = hmNameAttrNames.get(ocName.toLowerCase());
      if (attr != null && attr.equalsIgnoreCase(attrName))
      {
@@ -1357,14 +1339,9 @@
    return false;
  }
  private boolean hasBinaryValue(List<Object> values)
  {
    return !values.isEmpty() && values.iterator().next() instanceof byte[];
  }
  private boolean mustAddBrowseButton(String attrName)
  {
    if (ServerConstants.ATTR_UNIQUE_MEMBER_LC.equalsIgnoreCase(attrName)
    if (ATTR_UNIQUE_MEMBER_LC.equalsIgnoreCase(attrName)
        || "ds-target-group-dn".equalsIgnoreCase(attrName))
    {
      return true;
@@ -1403,12 +1380,10 @@
  private void appendLDIFLines(StringBuilder sb, String attrName)
  {
    {
      appendLDIFLines(sb, attrName, getValues(attrName));
    }
    appendLDIFLines(sb, attrName, getValues(attrName));
  }
  private void appendLDIFLines(StringBuilder sb, String attrName, List<Object> values)
  private void appendLDIFLines(StringBuilder sb, String attrName, List<?> values)
  {
    for (Object value : values)
    {
@@ -1540,7 +1515,7 @@
      previousTitle = browseEntriesPanel.getTitle();
      previousFilter = browseEntriesPanel.getFilter();
    }
    if (ServerConstants.ATTR_UNIQUE_MEMBER_LC.equalsIgnoreCase(attrName))
    if (ATTR_UNIQUE_MEMBER_LC.equalsIgnoreCase(attrName))
    {
      title = INFO_CTRL_PANEL_ADD_MEMBERS_LABEL.get();
      filter = LDAPEntrySelectionPanel.Filter.USERS;
@@ -1591,15 +1566,15 @@
    }
  }
  private String getPasswordStringValue(Object o)
  private String getPasswordStringValue(String attrName, ByteString v)
  {
    if (o instanceof byte[])
    if (isBinary(attrName))
    {
      return Base64.encode((byte[])o);
      return Base64.encode(v.toByteArray());
    }
    else
    {
      return String.valueOf(o);
      return v.toString();
    }
  }
@@ -1610,7 +1585,7 @@
    for (String attrName : schemaReadOnlyAttributesLowerCase)
    {
      List<Object> values = searchResult.getAttributeValues(attrName);
      List<ByteString> values = searchResult.getAttributeValues(attrName);
      if (!values.isEmpty())
      {
        newResult.set(attrName, values);
@@ -1662,7 +1637,7 @@
          List<String> newPwds = getNewPasswords(attrName);
          if (newPwds.equals(lastUserPasswords.get(attrName)))
          {
            List<Object> oldValues = searchResult.getAttributeValues(attrName);
            List<ByteString> oldValues = searchResult.getAttributeValues(attrName);
            newResult.set(attrName, oldValues);
          }
          else
@@ -1670,8 +1645,7 @@
            setValues(newResult, attrName);
          }
        }
        else if (!schemaReadOnlyAttributesLowerCase.contains(
          attrName.toLowerCase()))
        else if (!schemaReadOnlyAttributesLowerCase.contains(attrName.toLowerCase()))
        {
          setValues(newResult, attrName);
        }
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java
@@ -101,6 +101,7 @@
import org.opends.guitools.controlpanel.util.Utilities;
import org.opends.quicksetup.ui.CustomHTMLEditorKit;
import org.opends.server.types.OpenDsException;
import org.opends.server.types.Schema;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.StaticUtils;
@@ -1029,6 +1030,18 @@
  }
  /**
   * Returns whether the provided attribute name has binary syntax.
   * @param attrName the attribute name.
   * @return {@code true} if the provided attribute name has binary syntax,
   * {@code false} otherwise.
   */
  protected boolean isBinary(String attrName)
  {
    Schema schema = getInfo().getServerDescriptor().getSchema();
    return Utilities.hasBinarySyntax(attrName, schema);
  }
  /**
   * Returns the control panel info object.
   *
   * @return the control panel info object.
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
@@ -590,7 +590,7 @@
      requiredAttrs.clear();
      List<String> addedAttrs = new ArrayList<>();
      Schema schema = getInfo().getServerDescriptor().getSchema();
      List<Object> ocs = null;
      List<ByteString> ocs = null;
      for (String attrName : searchResult.getAttributeNames())
      {
        if (ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME.equalsIgnoreCase(attrName))
@@ -598,8 +598,7 @@
          if (schema != null)
          {
            ocs = searchResult.getAttributeValues(attrName);
            ObjectClassValue ocValue = getObjectClassDescriptor(
                ocs, schema);
            ObjectClassValue ocValue = getObjectClassDescriptor(ocs, schema);
            allSortedValues.add(new AttributeValuePair(attrName, ocValue));
          }
        }
@@ -615,9 +614,9 @@
      }
      if (ocs != null && schema != null)
      {
        for (Object oc : ocs)
        for (ByteString oc : ocs)
        {
          ObjectClass objectClass = schema.getObjectClass((String) oc);
          ObjectClass objectClass = schema.getObjectClass(oc.toString());
          if (!objectClass.isPlaceHolder())
          {
            for (AttributeType attr : objectClass.getRequiredAttributes())
@@ -717,12 +716,11 @@
    private void updateObjectClass(ObjectClassValue newValue)
    {
      CustomSearchResult oldResult = searchResult;
      CustomSearchResult newResult =
        new CustomSearchResult(searchResult.getDN());
      CustomSearchResult newResult = new CustomSearchResult(searchResult.getDN());
      for (String attrName : schemaReadOnlyAttributesLowerCase)
      {
        List<Object> values = searchResult.getAttributeValues(attrName);
        List<ByteString> values = searchResult.getAttributeValues(attrName);
        if (!values.isEmpty())
        {
          newResult.set(attrName, values);
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
@@ -18,6 +18,7 @@
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.opends.server.util.ServerConstants.*;
import java.awt.Container;
import java.awt.GridBagConstraints;
@@ -55,7 +56,6 @@
import org.opends.server.types.OpenDsException;
import org.opends.server.types.Schema;
import org.opends.server.util.Base64;
import org.opends.server.util.ServerConstants;
/**
 * Abstract class containing code shared by the different LDAP entry view
@@ -203,8 +203,7 @@
      title.setIcon(null);
    }
    List<Object> ocs =
      sr.getAttributeValues(ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
    List<ByteString> ocs = sr.getAttributeValues(OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
    Schema schema = getInfo().getServerDescriptor().getSchema();
    if (!ocs.isEmpty() && schema != null)
    {
@@ -240,14 +239,13 @@
   * @return an object class value representing all the object class values of
   * the entry.
   */
  protected ObjectClassValue getObjectClassDescriptor(List<Object> ocValues,
      Schema schema)
  protected ObjectClassValue getObjectClassDescriptor(List<ByteString> ocValues, Schema schema)
  {
    ObjectClass structuralObjectClass = null;
    SortedSet<String> auxiliaryClasses = new TreeSet<>();
    for (Object o : ocValues)
    for (ByteString oc : ocValues)
    {
      ObjectClass objectClass = schema.getObjectClass(((String) o));
      ObjectClass objectClass = schema.getObjectClass(oc.toString());
      if (!objectClass.isPlaceHolder())
      {
        if (objectClass.getObjectClassType() == ObjectClassType.STRUCTURAL)
@@ -357,60 +355,61 @@
      ObjectClassValue ocValue = (ObjectClassValue)value;
      if (ocValue.getStructural() != null)
      {
        sb.append("\n");
        sb.append(attrName).append(": ").append(ocValue.getStructural());
        appendPlain(sb, attrName, ocValue.getStructural());
        Schema schema = getInfo().getServerDescriptor().getSchema();
        if (schema != null)
        {
          ObjectClass oc = schema.getObjectClass(ocValue.getStructural());
          if (!oc.isPlaceHolder())
          {
            Set<String> names = getObjectClassSuperiorValues(oc);
            for (String name : names)
            for (String name : getObjectClassSuperiorValues(oc))
            {
              sb.append("\n");
              sb.append(attrName).append(": ").append(name);
              appendPlain(sb, attrName, name);
            }
          }
        }
      }
      for (String v : ocValue.getAuxiliary())
      {
        sb.append("\n");
        sb.append(attrName).append(": ").append(v);
        appendPlain(sb, attrName, v);
      }
    }
    else if (value instanceof ByteString)
    {
      ByteString v = (ByteString) value;
      if (v.length() > 0)
      {
        appendBase64(sb, attrName, Base64.encode(v.toByteArray()));
      }
    }
    else if (value instanceof byte[])
    {
      if (((byte[])value).length > 0)
      {
        sb.append("\n");
        sb.append(attrName).append(":: ").append(Base64.encode((byte[])value));
        appendBase64(sb, attrName, Base64.encode((byte[]) value));
      }
    }
    else if (value instanceof BinaryValue)
    {
      sb.append("\n");
      sb.append(attrName).append(":: ").append(((BinaryValue)value).getBase64());
      appendBase64(sb, attrName, ((BinaryValue) value).getBase64());
    }
    else if (String.valueOf(value).trim().length() > 0)
    {
      sb.append("\n");
      sb.append(attrName).append(": ").append(value);
      appendPlain(sb, attrName, value);
    }
  }
  /**
   * Returns <CODE>true</CODE> if the provided attribute name has binary syntax
   * and <CODE>false</CODE> otherwise.
   * @param attrName the attribute name.
   * @return <CODE>true</CODE> if the provided attribute name has binary syntax
   * and <CODE>false</CODE> otherwise.
   */
  protected boolean isBinary(String attrName)
  private void appendPlain(StringBuilder sb, String attrName, Object value)
  {
    Schema schema = getInfo().getServerDescriptor().getSchema();
    return Utilities.hasBinarySyntax(attrName, schema);
    sb.append("\n");
    sb.append(attrName).append(": ").append(value);
  }
  private void appendBase64(StringBuilder sb, String attrName, String base64Value)
  {
    sb.append("\n");
    sb.append(attrName).append(":: ").append(base64Value);
  }
  /**
@@ -443,7 +442,7 @@
  protected void setValues(CustomSearchResult sr, String attrName)
  {
    List<Object> values = getValues(attrName);
    List<Object> valuesToSet = new ArrayList<>();
    List<ByteString> valuesToSet = new ArrayList<>();
    for (Object value : values)
    {
      if (value instanceof ObjectClassValue)
@@ -451,28 +450,36 @@
        ObjectClassValue ocValue = (ObjectClassValue)value;
        if (ocValue.getStructural() != null)
        {
          valuesToSet.add(ocValue.getStructural());
          valuesToSet.add(ByteString.valueOfUtf8(ocValue.getStructural()));
        }
        valuesToSet.addAll(ocValue.getAuxiliary());
        SortedSet<String> auxiliaries = ocValue.getAuxiliary();
        for (String auxiliary : auxiliaries)
        {
          valuesToSet.add(ByteString.valueOfUtf8(auxiliary));
        }
      }
      else if (value instanceof byte[])
      {
        valuesToSet.add(value);
        valuesToSet.add(ByteString.wrap((byte[]) value));
      }
      else if (value instanceof BinaryValue)
      {
        try
        {
          valuesToSet.add(((BinaryValue)value).getBytes());
          valuesToSet.add(ByteString.wrap(((BinaryValue) value).getBytes()));
        }
        catch (ParseException pe)
        {
         throw new RuntimeException("Unexpected error: "+pe, pe);
        }
      }
      else if (String.valueOf(value).trim().length() > 0)
      else
      {
        valuesToSet.add(String.valueOf(value));
        String s = String.valueOf(value);
        if (s.trim().length() > 0)
        {
          valuesToSet.add(ByteString.valueOfUtf8(s));
        }
      }
    }
    if (!valuesToSet.isEmpty())
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java
@@ -2420,13 +2420,13 @@
  {
    if (sr != null)
    {
      final List<Object> values = sr.getAttributeValues(attrName);
      if (values != null && !values.isEmpty())
      final List<ByteString> values = sr.getAttributeValues(attrName);
      if (!values.isEmpty())
      {
        final Object o = values.get(0);
        if (o != null)
        final ByteString v = values.get(0);
        if (v != null)
        {
          return String.valueOf(o);
          return v.toString();
        }
      }
    }