// if the attribute exists in LDAP then replace the value,
// otherwise create a new attribute
Attribute ldapAttribute = ldapAttributes.get(sLdapKey);
if (ldapAttribute != null) {
if (!ldapAttribute.isOrdered()) {
ldapAttribute.clear();
ldapAttribute.add(sLocalValue);
} else {
ldapAttribute.set(0,sLocalValue);
}
modItem = new ModificationItem(DirContext.REPLACE_ATTRIBUTE,ldapAttribute);