throw new LdapAttributeInUseException( "Trying to add existing value '" + modAttr.get( ii ) + "' to attribute " + attrId );
throw new LdapAttributeInUseException( msg ); throw new LdapAttributeInUseException( msg );
/** * Checks to see the entry being modified exists, otherwise throws the appropriate LdapException. */ public void modify( NextInterceptor nextInterceptor, LdapDN name, ModificationItemImpl[] items ) throws NamingException { // check if entry to modify exists String msg = "Attempt to modify non-existant entry: "; assertHasEntry( nextInterceptor, msg, name ); Attributes entry = nexus.lookup( name ); for ( int ii = 0; ii < items.length; ii++ ) { if ( items[ii].getModificationOp() == DirContext.ADD_ATTRIBUTE ) { Attribute modAttr = items[ii].getAttribute(); Attribute entryAttr = entry.get( modAttr.getID() ); if ( entryAttr != null ) { for ( int jj = 0; jj < modAttr.size(); jj++ ) { if ( entryAttr.contains( modAttr.get( jj ) ) ) { throw new LdapAttributeInUseException( "Trying to add existing value '" + modAttr.get( jj ) + "' to attribute " + modAttr.getID() ); } } } } } nextInterceptor.modify( name, items ); }
throw new LdapAttributeInUseException( "found two copies of the following modification item: " + mods[ii] );