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/backends/SchemaBackend.java |   62 ++++++++++++++-----------------
 1 files changed, 28 insertions(+), 34 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
index 90f288c..673f15d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -3633,49 +3633,43 @@
 
     // loop on the attribute types in the entry just received
     // and add them in the existing schema.
-    List<Attribute> attrList = newSchemaEntry.getAttribute(attributeAttrType);
     Set<String> oidList = new HashSet<>(1000);
-    if (attrList != null && !attrList.isEmpty())
+    for (Attribute a : newSchemaEntry.getAttribute(attributeAttrType))
     {
-      for (Attribute a : attrList)
+      // Look for attribute types that could have been added to the schema
+      // or modified in the schema
+      for (ByteString v : a)
       {
-        // Look for attribute types that could have been added to the schema
-        // or modified in the schema
-        for (ByteString v : a)
+        // Parse the attribute type.
+        AttributeType attrType = AttributeTypeSyntax.decodeAttributeType(v, schema, false);
+        String schemaFile = getSchemaFile(attrType);
+        if (CONFIG_SCHEMA_ELEMENTS_FILE.equals(schemaFile))
         {
-          // Parse the attribute type.
-          AttributeType attrType = AttributeTypeSyntax.decodeAttributeType(v, schema, false);
-          String schemaFile = getSchemaFile(attrType);
-          if (CONFIG_SCHEMA_ELEMENTS_FILE.equals(schemaFile))
-          {
-            // Don't import the file containing the definitions of the
-            // Schema elements used for configuration because these
-            // definitions may vary between versions of OpenDJ.
-            continue;
-          }
+          // Don't import the file containing the definitions of the
+          // Schema elements used for configuration because these
+          // definitions may vary between versions of OpenDJ.
+          continue;
+        }
 
-          oidList.add(attrType.getOID());
-          try
+        oidList.add(attrType.getOID());
+        try
+        {
+          // Register this attribute type in the new schema
+          // unless it is already defined with the same syntax.
+          AttributeType oldAttrType = schema.getAttributeType(attrType.getOID());
+          if (oldAttrType == null || !oldAttrType.toString().equals(attrType.toString()))
           {
-            // Register this attribute type in the new schema
-            // unless it is already defined with the same syntax.
-            AttributeType oldAttrType =
-              schema.getAttributeType(attrType.getOID());
-            if (oldAttrType == null ||
-                !oldAttrType.toString().equals(attrType.toString()))
+            newSchema.registerAttributeType(attrType, true);
+
+            if (schemaFile != null)
             {
-              newSchema.registerAttributeType(attrType, true);
-
-              if (schemaFile != null)
-              {
-                modifiedSchemaFiles.add(schemaFile);
-              }
+              modifiedSchemaFiles.add(schemaFile);
             }
           }
-          catch (Exception e)
-          {
-            logger.info(NOTE_SCHEMA_IMPORT_FAILED, attrType, e.getMessage());
-          }
+        }
+        catch (Exception e)
+        {
+          logger.info(NOTE_SCHEMA_IMPORT_FAILED, attrType, e.getMessage());
         }
       }
     }

--
Gitblit v1.10.0