From 3e7100797afc9068d10990f57b46e868ff812966 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 28 Oct 2016 14:18:44 +0000
Subject: [PATCH] Use the new Entry.parseAttribute() method

---
 opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java |   25 ++-----------------------
 1 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java
index bde8767..0f0ee3f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java
@@ -110,27 +110,6 @@
     }
   }
 
-  /**
-   * Returns a string from the single valued attribute in provided entry.
-   *
-   * @param entry the entry
-   * @param attrName the attribute name
-   * @return the string value if available or {@code null}
-   */
-  public static String getStringSingleValuedAttribute(Entry entry, String attrName)
-  {
-    Iterator<Attribute> attributes = entry.getAllAttributes(attrName).iterator();
-    if (attributes.hasNext())
-    {
-      Attribute attribute = attributes.next();
-      for (ByteString byteString : attribute)
-      {
-        return byteString.toString();
-      }
-    }
-    return null;
-  }
-
   private static List<DN> getBaseDNsForEntry(final Entry configEntry) throws Exception
   {
     try
@@ -173,7 +152,7 @@
   {
     try
     {
-      return getStringSingleValuedAttribute(configEntry, ATTR_BACKEND_CLASS);
+      return configEntry.parseAttribute(ATTR_BACKEND_CLASS).asString();
     }
     catch (final Exception e)
     {
@@ -186,7 +165,7 @@
   {
     try
     {
-      return getStringSingleValuedAttribute(configEntry, ATTR_BACKEND_ID);
+      return configEntry.parseAttribute(ATTR_BACKEND_ID).asString();
     }
     catch (final Exception e)
     {

--
Gitblit v1.10.0