From 8cf467249a3cdfdab500aecd7b4dfaadd9f2c1bb Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Tue, 08 Jun 2010 09:28:19 +0000
Subject: [PATCH] Fix issue 4446: allow empty attributes to be added to entries and also add support for empty attributes to LDIFWriter. This was preventing types-only from working in searches.

---
 sdk/src/org/opends/sdk/AbstractMapEntry.java |   26 +++++++++++---------------
 1 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/sdk/src/org/opends/sdk/AbstractMapEntry.java b/sdk/src/org/opends/sdk/AbstractMapEntry.java
index 800a6b5..6dcfc77 100644
--- a/sdk/src/org/opends/sdk/AbstractMapEntry.java
+++ b/sdk/src/org/opends/sdk/AbstractMapEntry.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2009 Sun Microsystems, Inc.
+ *      Copyright 2009-2010 Sun Microsystems, Inc.
  */
 
 package org.opends.sdk;
@@ -74,22 +74,18 @@
   {
     Validator.ensureNotNull(attribute);
 
-    if (!attribute.isEmpty())
+    final AttributeDescription attributeDescription = attribute
+        .getAttributeDescription();
+    final Attribute oldAttribute = attributes.get(attributeDescription);
+    if (oldAttribute != null)
     {
-      final AttributeDescription attributeDescription = attribute
-          .getAttributeDescription();
-      final Attribute oldAttribute = attributes.get(attributeDescription);
-      if (oldAttribute != null)
-      {
-        return oldAttribute.addAll(attribute, duplicateValues);
-      }
-      else
-      {
-        attributes.put(attributeDescription, attribute);
-        return true;
-      }
+      return oldAttribute.addAll(attribute, duplicateValues);
     }
-    return false;
+    else
+    {
+      attributes.put(attributeDescription, attribute);
+      return true;
+    }
   }
 
 

--
Gitblit v1.10.0