LDAP-151 DistinguishedName violates the equals()/hashCode() contract

This commit is contained in:
Ulrik Sandberg
2008-11-13 14:37:40 +00:00
parent ec53690345
commit df318a5c01
2 changed files with 3 additions and 3 deletions

View File

@@ -161,7 +161,7 @@ public class LdapRdnComponent implements Comparable, Serializable {
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return key.hashCode() ^ value.hashCode();
return key.toUpperCase().hashCode() ^ value.toUpperCase().hashCode();
}
/*

View File

@@ -140,8 +140,8 @@ public class DistinguishedNameTest extends TestCase {
// original object
final Object originalObject = new DistinguishedName("cn=john.doe, OU=Users,OU=Some company,C=SE");
// another object that has the same values as the original
final Object identicalObject = new DistinguishedName("cn=john.doe, OU=Users,OU=Some company,C=SE");
// another object that has the same values as the original (case is ignored)
final Object identicalObject = new DistinguishedName("cn=john.doe, OU=Users,OU=SOME COMPANY,C=SE");
// another object with different values
final Object differentObject = new DistinguishedName("cn=john.doe, OU=Users,OU=Some other company,C=SE");