// We must remove all values of the attributes map for this
// attribute type but the one that has the value which is in the RDN
// of the entry. In fact the (underlying )attribute list does not
// suppot remove so we have to create a new list, keeping only the
// attribute value which is the same as in the RDN
AttributeValue rdnAttributeValue =
entryRdn.getAttributeValue(attributeType);
List<Attribute> attrList = attributesMap.get(attributeType);
Iterator<Attribute> attrIt = attrList.iterator();
AttributeValue sameAttrValue = null;
// Locate the attribute value identical to the one in the RDN
while(attrIt.hasNext())
{
Attribute attr = attrIt.next();
if (attr.contains(rdnAttributeValue))
{
Iterator<AttributeValue> attrValues = attr.iterator();
while(attrValues.hasNext())
{
AttributeValue attrValue = attrValues.next();
if (rdnAttributeValue.equals(attrValue))
{
// Keep the value we want
sameAttrValue = attrValue;
}