From 91d372cca007303222f2ec621da6b2e62480fbc3 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 25 Aug 2015 16:02:28 +0000
Subject: [PATCH] Use Collection.contains() Used early exits Removed duplicated code

---
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java |   22 +++-------------------
 1 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
index ddca70c..9c8cae7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
@@ -24,7 +24,6 @@
  *      Copyright 2008-2010 Sun Microsystems, Inc.
  *      Portions Copyright 2014-2015 ForgeRock AS
  */
-
 package org.opends.guitools.controlpanel.task;
 
 import static org.opends.messages.AdminToolMessages.*;
@@ -65,9 +64,7 @@
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.types.*;
 
-/**
- * The task that is called when we must modify an entry.
- */
+/** The task that is called when we must modify an entry. */
 public class ModifyEntryTask extends Task
 {
   private Set<String> backendSet;
@@ -170,7 +167,6 @@
     return INFO_CTRL_PANEL_MODIFY_ENTRY_TASK_DESCRIPTION.get(oldEntry.getDN());
   }
 
-
   /** {@inheritDoc} */
   protected String getCommandLinePath()
   {
@@ -466,7 +462,7 @@
     for (int i = 0; i < rdn.getNumValues(); i++)
     {
       List<Object> values = entry.getAttributeValues(rdn.getAttributeName(i));
-      if (!!values.isEmpty())
+      if (values.isEmpty())
       {
         return false;
       }
@@ -547,7 +543,7 @@
         if (oldRDN.getAttributeName(i).equalsIgnoreCase(attrName))
         {
           ByteString value = oldRDN.getAttributeValue(i);
-          if (containsValue(attr, value))
+          if (attr.contains(value))
           {
             if (rdnValue == null || !rdnValue.equals(value))
             {
@@ -655,18 +651,6 @@
     return false;
   }
 
-  private static boolean containsValue(org.opends.server.types.Attribute attr, Object value)
-  {
-    for (Iterator<ByteString> it = attr.iterator(); it.hasNext();)
-    {
-      if (value.equals(it.next()))
-      {
-        return true;
-      }
-    }
-    return false;
-  }
-
   /**
    * Creates a JNDI attribute using an attribute name and a set of values.
    * @param attrName the attribute name.

--
Gitblit v1.10.0