if (obj == null) {
createSubcontext(name, attributes);
return;
}
Result result = DirectoryManager.getStateToBind(obj, name, this, env,
attributes);
Object o = result.getObject();
Attributes attrs = null;
if (o instanceof Reference) {
attrs = convertRefToAttribute((Reference) o);
} else if (o instanceof Referenceable) {
attrs = convertRefToAttribute(((Referenceable) o).getReference());
} else if (o instanceof Serializable) {
attrs = convertSerialToAttribute((Serializable) o);
} else if (o instanceof DirContext) {
DirContext cxt = (DirContext) o;
attrs = cxt.getAttributes("");
} else {
throw new IllegalArgumentException(Messages.getString("ldap.24")); //$NON-NLS-1$
}
NamingEnumeration<? extends Attribute> enu = attrs.getAll();
if (result.getAttributes() != null) {
Attributes resultAttributes = result.getAttributes();
while (enu.hasMore()) {
Attribute element = enu.next();
if (element.getID().equalsIgnoreCase("objectClass")) {
element = mergeAttribute(resultAttributes