jdk/src/share/classes/javax/naming/ldap/Rdn.java
changeset 10369 e9d2e59e53f0
parent 10324 e28265130e4f
child 21285 e740104a04f1
child 21278 ef8a3a2a72f2
equal deleted inserted replaced
10368:79494b8dc2b1 10369:e9d2e59e53f0
    26 package javax.naming.ldap;
    26 package javax.naming.ldap;
    27 
    27 
    28 import java.util.Iterator;
    28 import java.util.Iterator;
    29 import java.util.NoSuchElementException;
    29 import java.util.NoSuchElementException;
    30 import java.util.ArrayList;
    30 import java.util.ArrayList;
       
    31 import java.util.Locale;
    31 import java.util.Collections;
    32 import java.util.Collections;
    32 
    33 
    33 import javax.naming.InvalidNameException;
    34 import javax.naming.InvalidNameException;
    34 import javax.naming.directory.BasicAttributes;
    35 import javax.naming.directory.BasicAttributes;
    35 import javax.naming.directory.Attributes;
    36 import javax.naming.directory.Attributes;
   432         Object getValue() {
   433         Object getValue() {
   433             return value;
   434             return value;
   434         }
   435         }
   435 
   436 
   436         public int compareTo(RdnEntry that) {
   437         public int compareTo(RdnEntry that) {
   437             int diff = type.toUpperCase().compareTo(
   438             int diff = type.compareToIgnoreCase(that.type);
   438                         that.type.toUpperCase());
       
   439             if (diff != 0) {
   439             if (diff != 0) {
   440                 return diff;
   440                 return diff;
   441             }
   441             }
   442             if (value.equals(that.value)) {     // try shortcut
   442             if (value.equals(that.value)) {     // try shortcut
   443                 return 0;
   443                 return 0;
   460                         (getValueComparable().equals(
   460                         (getValueComparable().equals(
   461                         that.getValueComparable()));
   461                         that.getValueComparable()));
   462         }
   462         }
   463 
   463 
   464         public int hashCode() {
   464         public int hashCode() {
   465             return (type.toUpperCase().hashCode() +
   465             return (type.toUpperCase(Locale.ENGLISH).hashCode() +
   466                 getValueComparable().hashCode());
   466                 getValueComparable().hashCode());
   467         }
   467         }
   468 
   468 
   469         public String toString() {
   469         public String toString() {
   470             return type + "=" + escapeValue(value);
   470             return type + "=" + escapeValue(value);
   477 
   477 
   478             // cache result
   478             // cache result
   479             if (value instanceof byte[]) {
   479             if (value instanceof byte[]) {
   480                 comparable = escapeBinaryValue((byte[]) value);
   480                 comparable = escapeBinaryValue((byte[]) value);
   481             } else {
   481             } else {
   482                 comparable = ((String) value).toUpperCase();
   482                 comparable = ((String) value).toUpperCase(Locale.ENGLISH);
   483             }
   483             }
   484             return comparable;
   484             return comparable;
   485         }
   485         }
   486     }
   486     }
   487 
   487 
   567             byte b = val[i];
   567             byte b = val[i];
   568             builder.append(Character.forDigit(0xF & (b >>> 4), 16));
   568             builder.append(Character.forDigit(0xF & (b >>> 4), 16));
   569             builder.append(Character.forDigit(0xF & b, 16));
   569             builder.append(Character.forDigit(0xF & b, 16));
   570         }
   570         }
   571         return builder.toString();
   571         return builder.toString();
   572         // return builder.toString().toUpperCase();
       
   573     }
   572     }
   574 
   573 
   575     /**
   574     /**
   576      * Given an attribute value string formated according to the rules
   575      * Given an attribute value string formated according to the rules
   577      * specified in
   576      * specified in