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/pluggable/VLVIndex.java |   40 ++++++++++++++++++----------------------
 1 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
index cc2a40e..ec0b7a0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
@@ -770,34 +770,30 @@
     {
       final AttributeType attributeType = sortKey.getAttributeType();
       final MatchingRule matchingRule = sortKey.getEffectiveOrderingRule();
-      final List<Attribute> attrList = entry.getAttribute(attributeType);
       ByteString sortValue = null;
-      if (attrList != null)
+      for (Attribute a : entry.getAttribute(attributeType))
       {
-        for (Attribute a : attrList)
+        for (ByteString v : a)
         {
-          for (ByteString v : a)
+          try
           {
-            try
+            /*
+             * The RFC states that the lowest value of a multi-valued attribute should be used,
+             * regardless of the sort order.
+             */
+            final ByteString nv = matchingRule.normalizeAttributeValue(v);
+            if (sortValue == null || nv.compareTo(sortValue) < 0)
             {
-              /*
-               * The RFC states that the lowest value of a multi-valued attribute should be used,
-               * regardless of the sort order.
-               */
-              final ByteString nv = matchingRule.normalizeAttributeValue(v);
-              if (sortValue == null || nv.compareTo(sortValue) < 0)
-              {
-                sortValue = nv;
-              }
+              sortValue = nv;
             }
-            catch (final DecodeException e)
-            {
-              /*
-               * This shouldn't happen because the attribute should have already been validated. If
-               * it does then treat the value as missing.
-               */
-              continue;
-            }
+          }
+          catch (final DecodeException e)
+          {
+            /*
+             * This shouldn't happen because the attribute should have already been validated.
+             * If it does then treat the value as missing.
+             */
+            continue;
           }
         }
       }

--
Gitblit v1.10.0