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/ReferentialIntegrityPlugin.java |   25 ++++++-------------------
 1 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java b/opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java
index daac73e..a83d606 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java
@@ -1107,14 +1107,10 @@
     return PluginResult.PreOperation.continueOperationProcessing();
   }
 
-  /** {@inheritDoc} */
   @Override
-  public PluginResult.PreOperation doPreOperation(
-    PreOperationAddOperation addOperation)
+  public PluginResult.PreOperation doPreOperation(PreOperationAddOperation addOperation)
   {
-    /* Skip the integrity checks if the enforcing is not enabled.
-     */
-
+    // Skip the integrity checks if the enforcing is not enabled.
     if (!currentConfiguration.isCheckReferences())
     {
       return PluginResult.PreOperation.continueOperationProcessing();
@@ -1122,9 +1118,7 @@
 
     final Entry entry = addOperation.getEntryToAdd();
 
-    /* Make sure the entry belongs to one of the configured naming
-     * contexts.
-     */
+    // Make sure the entry belongs to one of the configured naming contexts.
     DN entryDN = entry.getName();
     DN entryBaseDN = getEntryBaseDN(entryDN);
     if (entryBaseDN == null)
@@ -1135,20 +1129,13 @@
     for (AttributeType attrType : attributeTypes)
     {
       final List<Attribute> attrs = entry.getAttribute(attrType, false);
-
-      if (attrs != null)
+      PluginResult.PreOperation result = isIntegrityMaintained(attrs, entryDN, entryBaseDN);
+      if (result.getResultCode() != ResultCode.SUCCESS)
       {
-        PluginResult.PreOperation result =
-        isIntegrityMaintained(attrs, entryDN, entryBaseDN);
-        if (result.getResultCode() != ResultCode.SUCCESS)
-        {
-          return result;
-        }
+        return result;
       }
     }
 
-    /* If we reahed this point, everything is fine.
-     */
     return PluginResult.PreOperation.continueOperationProcessing();
   }
 

--
Gitblit v1.10.0