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/plugins/PasswordPolicyImportPlugin.java |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java b/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
index b634ac9..ed68a00 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
@@ -38,6 +38,11 @@
 import java.util.Set;
 
 import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.config.server.ConfigChangeResult;
+import org.forgerock.opendj.config.server.ConfigException;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ResultCode;
 import org.opends.server.admin.server.ConfigurationChangeListener;
 import org.opends.server.admin.std.meta.PluginCfgDefn;
 import org.opends.server.admin.std.server.PasswordPolicyImportPluginCfg;
@@ -49,17 +54,12 @@
 import org.opends.server.api.plugin.DirectoryServerPlugin;
 import org.opends.server.api.plugin.PluginResult;
 import org.opends.server.api.plugin.PluginType;
-import org.forgerock.opendj.config.server.ConfigChangeResult;
-import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.PasswordPolicy;
 import org.opends.server.core.SubentryPasswordPolicy;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.schema.AuthPasswordSyntax;
 import org.opends.server.schema.UserPasswordSyntax;
 import org.opends.server.types.*;
-import org.forgerock.opendj.ldap.ResultCode;
-import org.forgerock.opendj.ldap.ByteString;
 
 /**
  * This class implements a Directory Server plugin that performs various
@@ -330,7 +330,7 @@
     // See if the entry explicitly states the password policy that it should
     // use.  If so, then only use it to perform the encoding.
     List<Attribute> attrList = entry.getAttribute(customPolicyAttribute);
-    if (attrList != null)
+    if (!attrList.isEmpty())
     {
       DN policyDN = null;
       PasswordPolicy policy = null;
@@ -369,7 +369,7 @@
         if (schemes != null)
         {
           attrList = entry.getAttribute(policy.getPasswordAttribute());
-          if (attrList == null)
+          if (attrList.isEmpty())
           {
             return PluginResult.ImportLDIF.continueEntryProcessing();
           }
@@ -455,7 +455,7 @@
     for (AttributeType t : authPasswordTypes)
     {
       attrList = entry.getAttribute(t);
-      if (attrList == null || attrList.isEmpty())
+      if (attrList.isEmpty())
       {
         continue;
       }
@@ -505,7 +505,7 @@
     for (AttributeType t : userPasswordTypes)
     {
       attrList = entry.getAttribute(t);
-      if (attrList == null || attrList.isEmpty())
+      if (attrList.isEmpty())
       {
         continue;
       }

--
Gitblit v1.10.0