Attributes attrsToRemove = ( Attributes ) oldEntry.clone(); NamingEnumeration e = oldEntry.getAll(); while ( e.hasMore() ) { Attribute attr = ( Attribute ) e.next(); String attrID = attr.getID(); if ( entry.get( attrID ) != null ) { attrsToRemove.remove( attrID ); } }
nexus.delete( normalizedName ); }
    protected void execute0( PartitionNexus nexus, ReplicationStore store ) throws NamingException    {        if ( !EntryUtil.isEntryUpdatable( nexus, normalizedName, getCSN() ) )        {            return;        }        EntryUtil.createGlueEntries( nexus, normalizedName, false );        // Replace the entry if an entry with the same name exists.        Attributes oldEntry = nexus.lookup( normalizedName );        if ( oldEntry != null )        {            // Find the attributes that new entry doesn't have.            Attributes attrsToRemove = ( Attributes ) oldEntry.clone();            NamingEnumeration e = oldEntry.getAll();            while ( e.hasMore() )            {                Attribute attr = ( Attribute ) e.next();                String attrID = attr.getID();                if ( entry.get( attrID ) != null )                {                    attrsToRemove.remove( attrID );                }            }            // Don't let RN attribute be removed            String rnAttrID = NamespaceTools.getRdnAttribute( normalizedName.get( normalizedName.size() - 1 ) );            attrsToRemove.remove( rnAttrID );            // Delete the attributes.            nexus.modify( normalizedName, DirContext.REMOVE_ATTRIBUTE, entry );            // Remove RN attribute from new entry because it should be the same            // with the old one.            entry.remove( rnAttrID );            // Now replace old entries with the new attributes            nexus.modify( normalizedName, DirContext.REPLACE_ATTRIBUTE, entry );        }        else        {            String rdn = normalizedName.get( normalizedName.size() - 1 );            // Remove the attribute first in case we're using a buggy             // LockableAttributesImpl which doesn't replace old attributes            // when we put a new one.            entry.remove( NamespaceTools.getRdnAttribute( rdn ) );            entry.put( NamespaceTools.getRdnAttribute( rdn ), NamespaceTools.getRdnValue( rdn ) );            nexus.add( normalizedName, entry );        }    }