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
| | |
| | | |
| | | /** |
| | | * 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; |
| | |
| | | |
| | | |
| | | /** |
| | | * 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. |
| | | */ |
| | |
| | | "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, |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | |