directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Lecharny (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DIRSHARED-142) Value<?> objects containing byte[] of same content should be equals() == true
Date Tue, 30 Oct 2012 15:40:12 GMT

    [ https://issues.apache.org/jira/browse/DIRSHARED-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13486951#comment-13486951
] 

Emmanuel Lecharny commented on DIRSHARED-142:
---------------------------------------------

I have added some tests :

        
        Attribute attr11 = new DefaultAttribute( atPwd, BYTES1 );
        Attribute attr12 = new DefaultAttribute( atPwd, BYTES1 );
        
        assertTrue( attr11.get().equals( attr12.get() ) );
        assertTrue( attr12.get().equals( attr11.get() ) );

        Attribute attr13 = new DefaultAttribute( "userPassword", BYTES1 );
        
        assertTrue( attr11.get().equals( attr13.get() ) );
        assertTrue( attr13.get().equals( attr11.get() ) );
        
        Attribute attr14 = new DefaultAttribute( "userPassword", BYTES1 );
        
        assertTrue( attr14.get().equals( attr13.get() ) );
        assertTrue( attr13.get().equals( attr14.get() ) );


where atPwd is an AttributeType, and BYTES1 = {0x41 0x42}. All the call to the equals() method
succeed.

There must obviously be something else going wrong with the specific value you are using...
                
> Value<?> objects containing byte[] of same content should be equals() == true
> -----------------------------------------------------------------------------
>
>                 Key: DIRSHARED-142
>                 URL: https://issues.apache.org/jira/browse/DIRSHARED-142
>             Project: Directory Shared
>          Issue Type: Bug
>    Affects Versions: 1.0.0-M13
>            Reporter: Hendy Irawan
>
> 1. get two Attribute objects from different sources, e.g. from LDAP connection vs. by
creating an entry programmatically
> 2. attribute1.get().equals( attribute2.get() ) will return false, which is wrong, because
:
> Arrays.equals((byte[])attribute1.get().getNormValue(), (byte[]) attribute2.get().getNormValue())
> will return true in this case.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message