From 14f94c13789b8ace4eae258b5f1d64494518f9c3 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 21 Dec 2015 14:04:12 +0000
Subject: [PATCH] Remove null checks on returned values of Entry.get*Attribute*() methods.

---
 opendj-server-legacy/src/main/java/org/opends/server/tasks/TaskUtils.java |   25 +++++++------------------
 1 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/TaskUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/TaskUtils.java
index 33306a2..5611b3c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/TaskUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/TaskUtils.java
@@ -167,10 +167,7 @@
         {
           continue;
         }
-        else
-        {
-          backendID = idAttr.activeValue();
-        }
+        backendID = idAttr.activeValue();
       }
       catch (org.opends.server.config.ConfigException ce)
       {
@@ -196,7 +193,7 @@
    * @return The configuration entry of the backend, or null if it could not
    * be found.
    */
-  public static BackendCfg getConfigEntry(Backend backend)
+  public static BackendCfg getConfigEntry(Backend<?> backend)
   {
     RootCfg root = ServerManagementContext.getInstance().
          getRootConfiguration();
@@ -262,8 +259,7 @@
    * @param backendID Identifies the backend to be disabled.
    * @throws DirectoryException If the internal modify operation failed.
    */
-  public static void disableBackend(String backendID)
-       throws DirectoryException
+  public static void disableBackend(String backendID) throws DirectoryException
   {
     DN configEntryDN;
     RootCfg root = ServerManagementContext.getInstance().getRootConfiguration();
@@ -312,11 +308,6 @@
   public static boolean getBoolean(List<Attribute> attrList,
                                    boolean defaultValue)
   {
-    if (attrList == null || attrList.isEmpty())
-    {
-      return defaultValue;
-    }
-
     for (Attribute a : attrList)
     {
       for (ByteString v  : a)
@@ -351,8 +342,7 @@
   public static ArrayList<String> getMultiValueString(List<Attribute> attrList)
   {
     ArrayList<String> valueStrings = new ArrayList<>();
-
-    if (attrList != null && !attrList.isEmpty())
+    if (!attrList.isEmpty())
     {
       Attribute attr = attrList.get(0);
       if (!attr.isEmpty())
@@ -378,7 +368,7 @@
    */
   public static String getSingleValueString(List<Attribute> attrList)
   {
-    if (attrList != null && !attrList.isEmpty())
+    if (!attrList.isEmpty())
     {
       Attribute attr = attrList.get(0);
       if (!attr.isEmpty())
@@ -401,10 +391,9 @@
    * @return The integer value of the attribute, or the provided default value
    * if there is no value.
    */
-  public static int getSingleValueInteger(List<Attribute> attrList,
-                                          int defaultValue)
+  public static int getSingleValueInteger(List<Attribute> attrList, int defaultValue)
   {
-    if (attrList != null && !attrList.isEmpty())
+    if (!attrList.isEmpty())
     {
       Attribute attr = attrList.get(0);
       if (!attr.isEmpty())

--
Gitblit v1.10.0