Issue Details (XML | Word | Printable)

Key: DIRSERVER-334
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Alex Karasulu
Reporter: Emmanuel Lecharny
Votes: 0
Watchers: 0
Operations

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

Pb with case sensitivity for attributes

Created: 13/Aug/05 07:11 AM   Updated: 24/Jun/06 08:41 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Resolution Date: 13/Aug/05 04:38 PM


 Description  « Hide
There is a huge problem with attributes. They are supposed to be case insensitive (RFC 2251, par. 2.5.1: "... they must be IA5 (ASCII) strings, and they are case insensitive (e.g. "foo@bar.com" will match "FOO@BAR.COM")")

If we use the BasicAttribute class (javax.naming.directory.BasicAttribute) without lowercasing the attribute's name, there is no way to guarantee that we could do a attributes.get( <name>.toLowerCase() ) with a correct response.

This usage is spreaded all over the code and need to be fixed.

As an example, here is a snapshot of a working code :

        /*
         * create objectClass=top, objectClass=organizationalUnit
         */
        Attributes attributes = new BasicAttributes();
        Attribute attribute = new BasicAttribute( "objectClass".toLowerCase() ); // we MUST lowercase the attribute's name
        attribute.add( "top" );
        attribute.add( "organizationalUnit" );
        attributes.put( attribute );
        
        Attribute attr = attributes.get("objectclass".toLowerCase());
        Attribute attr2 = attributes.get("objectClass".toLowerCase());
        Assert.assertTrue( attr == attr2 ); // no problem, they are equal.

        /*
         * The same piece of code, without the lowerCase()
         */
        Attributes attributes = new BasicAttributes();
        Attribute attribute = new BasicAttribute( "objectClass");
        attribute.add( "top" );
        attribute.add( "organizationalUnit" );
        attributes.put( attribute );
        
        Attribute attr = attributes.get("objectclass");
        Attribute attr2 = attributes.get("objectClass");
        Assert.assertTrue( attr == attr2 ); // they are different, as attr is null.




 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Emmanuel Lecharny made changes - 13/Aug/05 07:23 AM
Field Original Value New Value
Component/s jdbm database [ 11450 ]
Component/s server main [ 11494 ]
Alex Karasulu made changes - 13/Aug/05 03:53 PM
Assignee Alex Karasulu [ akarasulu ]
Alex Karasulu made changes - 13/Aug/05 04:10 PM
Status Open [ 1 ] In Progress [ 3 ]
Alex Karasulu made changes - 13/Aug/05 04:38 PM
Resolution Fixed [ 1 ]
Status In Progress [ 3 ] Resolved [ 5 ]
Alex Karasulu made changes - 10/Feb/06 12:34 PM
Key DIREVE-224 DIRSERVER-334
Component/s server main [ 11494 ]
Affects Version/s 0.9.2 [ 12310192 ]
Project Directory Server [ 10516 ] Directory ApacheDS [ 12310260 ]
Emmanuel Lecharny made changes - 24/Jun/06 08:41 PM
Status Resolved [ 5 ] Closed [ 6 ]