Java源码示例:javax.naming.directory.AttributeInUseException

示例1
private void bindServer() throws UnknownHostException, AttributeInUseException {
    if (Namespace.exists(getDefaultNamespaceName())) {
        LOG.error("EmissaryServer already bound to namespace. This should NEVER happen.");
        throw new AttributeInUseException("EmissaryServer was already bound to the namespace using serverName: " + DEFAULT_NAMESPACE_NAME);
    }

    LOG.debug("Binding {} ", DEFAULT_NAMESPACE_NAME);
    Namespace.bind(getDefaultNamespaceName(), this);

}
 
示例2
public void assignUser(String username, String groupName) throws NamingException {

        try {
            ModificationItem[] mods = new ModificationItem[1];
            Attribute mod = new BasicAttribute("member", getUserDN(username));
            mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, mod);
            context.modifyAttributes(getGroupDN(groupName), mods);
        } catch (AttributeInUseException e) {
            // If user is already added, ignore exception
        }
    }