Issue Details (XML | Word | Printable)

Key: DIRSERVER-256
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Alex Karasulu
Reporter: Claus Turkalj
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Directory ApacheDS

SchemaService modifies attibute while checking for removal of last attribute value

Created: 11/Nov/05 05:16 PM   Updated: 21/Apr/07 11:03 AM
Return to search
Component/s: None
Affects Version/s: pre-1.0
Fix Version/s: 1.0-RC1

Time Tracking:
Not Specified

Resolution Date: 13/Nov/05 02:40 AM


 Description  « Hide
The SchemaService is modifying an attribute although it is not the last interceptor in the interceptor chain. If one of the interceptors invoked after the SchemaService throws an exception, the modification has already been commited.

The modification happens while the SchemaService checks if a DirContext.REMOVE_ATTRIBUTE operation removes the last value of an attribute:

    private boolean isCompleteRemoval( Attribute change, Attributes entry ) throws NamingException
    {
        // if change size is 0 then all values are deleted then we're screwed
        if ( change.size() == 0 )
        {
            return true;
        }

        // can't do math to figure our if all values are removed since some
        // values in the modify request may not be in the entry. we need to
        // remove the values from a cloned version of the attribute and see
        // if nothing is left.
        Attribute changedEntryAttr = entry.get( change.getID() );
        for ( int jj = 0; jj < change.size(); jj++ )
        {
            changedEntryAttr.remove( change.get( jj ) );
        }

        return changedEntryAttr.size() == 0;
    }

Changing the line

        Attribute changedEntryAttr = entry.get( change.getID() );

to

        Attribute changedEntryAttr = entry.get( change.getID() ).clone();

seems to fix the problem.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alex Karasulu added a comment - 13/Nov/05 02:40 AM
Committed small recommended change in revision 332797

Emmanuel Lecharny added a comment - 21/Apr/07 11:03 AM
Closing all issues created in 2005 and before which are marked resolved