if (name == null) throw new IllegalArgumentException("Name required");
if (name.length() == 0) throw new InvalidNameException("Cannot bind object named after context");
// If it's an alias name, stop here.
if (aliases.containsKey(name))
throw new NameAlreadyBoundException("Name \"" + name + "\" already bound as an aliased name");
// Make sure it isn't bound anywhere
for (NamingEnumeration e = list(""); e.hasMore();) {
NameClassPair nameClassPair = (NameClassPair) e.next();
if (name.equals(nameClassPair.getName()))
throw new NameAlreadyBoundException("Name \"" + name + "\" already bound by a managed subcontext");
}
doRebind(name, obj);
}