mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

neil_a_wilson
07.48.2006 a35f8a47cca3dbdb584cad85c5aa61f27e0bf42a
Fix a bug that allows the server to overlook the fact that there are duplicate
values in an LDAP attribute when converting to a core Attribute (it would
silently discard the duplicate rather than rejecting it).

Also, fix an error in an unrelated Javadoc comment.

OpenDS Issue Number: 761
3 files modified
24 ■■■■■ changed files
opends/src/server/org/opends/server/messages/CoreMessages.java 3 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/messages/ProtocolMessages.java 13 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/ldap/LDAPAttribute.java 8 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/messages/CoreMessages.java
@@ -5928,7 +5928,8 @@
  /**
   * The message ID for the message that will be used if a modify operation does
   * not contain any modifications.  This does not take any arguments.
   * not contain any modifications.  This takes a single argument, which is the
   * DN of the entry to modify.
   */
  public static final int MSGID_MODIFY_NO_MODIFICATIONS =
       CATEGORY_MASK_CORE | SEVERITY_MASK_SEVERE_ERROR | 566;
opends/src/server/org/opends/server/messages/ProtocolMessages.java
@@ -4169,6 +4169,16 @@
  /**
   * The message ID for the message that will be used if an LDAP attribute
   * contains duplicate values.  This takes a single argument, which is the name
   * of the attribute.
   */
  public static final int MSGID_LDAP_ATTRIBUTE_DUPLICATE_VALUES =
       CATEGORY_MASK_PROTOCOL | SEVERITY_MASK_MILD_ERROR | 384;
  /**
   * Associates a set of generic messages with the message IDs defined in this
   * class.
   */
@@ -4661,6 +4671,9 @@
                    "Cannot decode the provided ASN.1 element as an LDAP " +
                    "attribute because the set of values could not be " +
                    "decoded:  %s.");
    registerMessage(MSGID_LDAP_ATTRIBUTE_DUPLICATE_VALUES,
                    "The provided LDAP attribute %s contains duplicate " +
                    "values.");
    registerMessage(MSGID_LDAP_ADD_REQUEST_DECODE_SEQUENCE,
opends/src/server/org/opends/server/protocols/ldap/LDAPAttribute.java
@@ -365,7 +365,13 @@
         new LinkedHashSet<AttributeValue>(values.size());
    for (ASN1OctetString value : values)
    {
      attributeValues.add(new AttributeValue(attrType, value));
      if (! attributeValues.add(new AttributeValue(attrType, value)))
      {
        int    msgID   = MSGID_LDAP_ATTRIBUTE_DUPLICATE_VALUES;
        String message = getMessage(msgID, attributeType);
        throw new LDAPException(LDAPResultCode.ATTRIBUTE_OR_VALUE_EXISTS, msgID,
                                message);
      }
    }