From 5e0a551935151242e4308053617c2f487a60d5f0 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 08 Aug 2016 07:31:26 +0000
Subject: [PATCH] Partial OPENDJ-3106 Migrate Entry

---
 opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java |   13 +++++++------
 1 files changed, 7 insertions(+), 6 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 89cbd4b..bde8767 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
@@ -17,6 +17,7 @@
 package org.opends.server.tools;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 import org.forgerock.i18n.slf4j.LocalizedLogger;
@@ -118,10 +119,10 @@
    */
   public static String getStringSingleValuedAttribute(Entry entry, String attrName)
   {
-    List<Attribute> attributes = entry.getAllAttributes(attrName);
-    if (!attributes.isEmpty())
+    Iterator<Attribute> attributes = entry.getAllAttributes(attrName).iterator();
+    if (attributes.hasNext())
     {
-      Attribute attribute = attributes.get(0);
+      Attribute attribute = attributes.next();
       for (ByteString byteString : attribute)
       {
         return byteString.toString();
@@ -134,10 +135,10 @@
   {
     try
     {
-      List<Attribute> attributes = configEntry.getAllAttributes(ATTR_BACKEND_BASE_DN);
-      if (!attributes.isEmpty())
+      Iterator<Attribute> attributes = configEntry.getAllAttributes(ATTR_BACKEND_BASE_DN).iterator();
+      if (attributes.hasNext())
       {
-        Attribute attribute = attributes.get(0);
+        Attribute attribute = attributes.next();
         List<DN> dns = new ArrayList<>();
         for (ByteString byteString : attribute)
         {

--
Gitblit v1.10.0