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/Entry.java |   50 +++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/sdk/src/org/opends/sdk/Entry.java b/sdk/src/org/opends/sdk/Entry.java
index 0b588e4..e237739 100644
--- a/sdk/src/org/opends/sdk/Entry.java
+++ b/sdk/src/org/opends/sdk/Entry.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2009 Sun Microsystems, Inc.
+ *      Copyright 2009-2010 Sun Microsystems, Inc.
  */
 
 package org.opends.sdk;
@@ -62,11 +62,19 @@
 {
 
   /**
-   * Adds all of the attribute values contained in {@code attribute} to this
-   * entry, merging with any existing attribute values (optional operation). If
-   * {@code attribute} is empty then this entry is left unchanged.
+   * Ensures that this entry contains the provided attribute and values
+   * (optional operation). This method has the following semantics:
+   * <ul>
+   * <li>If this entry does not already contain an attribute with the same
+   * attribute description, then this entry will be modified such that it
+   * contains {@code attribute}, even if it is empty.
+   * <li>If this entry already contains an attribute with the same attribute
+   * description, then the attribute values contained in {@code attribute} will
+   * be merged with the existing attribute values.
+   * </ul>
    * <p>
-   * <b>NOTE:</b> This method implements LDAP Modify add semantics.
+   * <b>NOTE:</b> When {@code attribute} is non-empty, this method implements
+   * LDAP Modify add semantics.
    *
    * @param attribute
    *          The attribute values to be added to this entry, merging with any
@@ -84,11 +92,19 @@
 
 
   /**
-   * Adds all of the attribute values contained in {@code attribute} to this
-   * entry, merging with any existing attribute values (optional operation). If
-   * {@code attribute} is empty then this entry is left unchanged.
+   * Ensures that this entry contains the provided attribute and values
+   * (optional operation). This method has the following semantics:
+   * <ul>
+   * <li>If this entry does not already contain an attribute with the same
+   * attribute description, then this entry will be modified such that it
+   * contains {@code attribute}, even if it is empty.
+   * <li>If this entry already contains an attribute with the same attribute
+   * description, then the attribute values contained in {@code attribute} will
+   * be merged with the existing attribute values.
+   * </ul>
    * <p>
-   * <b>NOTE:</b> This method implements LDAP Modify add semantics.
+   * <b>NOTE:</b> When {@code attribute} is non-empty, this method implements
+   * LDAP Modify add semantics.
    *
    * @param attribute
    *          The attribute values to be added to this entry, merging with any
@@ -110,9 +126,16 @@
 
 
   /**
-   * Adds all of the attribute values contained in {@code values} to this entry,
-   * merging with any existing attribute values (optional operation). If {@code
-   * values} is {@code null} or empty then this entry is left unchanged.
+   * Ensures that this entry contains the provided attribute and values
+   * (optional operation). This method has the following semantics:
+   * <ul>
+   * <li>If this entry does not already contain an attribute with the same
+   * attribute description, then this entry will be modified such that it
+   * contains {@code attribute}, even if it is empty.
+   * <li>If this entry already contains an attribute with the same attribute
+   * description, then the attribute values contained in {@code attribute} will
+   * be merged with the existing attribute values.
+   * </ul>
    * <p>
    * The attribute description will be decoded using the schema associated with
    * this entry (usually the default schema).
@@ -120,7 +143,8 @@
    * Any attribute values which are not instances of {@code ByteString} will be
    * converted using the {@link ByteString#valueOf(Object)} method.
    * <p>
-   * <b>NOTE:</b> This method implements LDAP Modify add semantics.
+   * <b>NOTE:</b> When {@code attribute} is non-empty, this method implements
+   * LDAP Modify add semantics.
    *
    * @param attributeDescription
    *          The name of the attribute whose values are to be added.

--
Gitblit v1.10.0