1919import java .io .Serializable ;
2020import java .net .URI ;
2121import java .net .URISyntaxException ;
22+ import java .util .Locale ;
2223
2324import org .slf4j .Logger ;
2425import org .slf4j .LoggerFactory ;
@@ -75,10 +76,10 @@ public LdapRdnComponent(String key, String value, boolean decodeValue) {
7576
7677 String caseFold = System .getProperty (DistinguishedName .KEY_CASE_FOLD_PROPERTY );
7778 if (!StringUtils .hasText (caseFold ) || caseFold .equals (DistinguishedName .KEY_CASE_FOLD_LOWER )) {
78- this .key = key .toLowerCase ();
79+ this .key = key .toLowerCase (Locale . ROOT );
7980 }
8081 else if (caseFold .equals (DistinguishedName .KEY_CASE_FOLD_UPPER )) {
81- this .key = key .toUpperCase ();
82+ this .key = key .toUpperCase (Locale . ROOT );
8283 }
8384 else if (caseFold .equals (DistinguishedName .KEY_CASE_FOLD_NONE )) {
8485 this .key = key ;
@@ -88,7 +89,7 @@ else if (caseFold.equals(DistinguishedName.KEY_CASE_FOLD_NONE)) {
8889 + "; expected \" " + DistinguishedName .KEY_CASE_FOLD_LOWER + "\" , \" "
8990 + DistinguishedName .KEY_CASE_FOLD_UPPER + "\" , or \" " + DistinguishedName .KEY_CASE_FOLD_NONE
9091 + "\" " );
91- this .key = key .toLowerCase ();
92+ this .key = key .toLowerCase (Locale . ROOT );
9293 }
9394 if (decodeValue ) {
9495 this .value = LdapEncoder .nameDecode (value );
@@ -203,7 +204,7 @@ public boolean equals(Object obj) {
203204 */
204205 @ Override
205206 public int hashCode () {
206- return this .key .toUpperCase ().hashCode () ^ this .value .toUpperCase ().hashCode ();
207+ return this .key .toUpperCase (Locale . ROOT ).hashCode () ^ this .value .toUpperCase (Locale . ROOT ).hashCode ();
207208 }
208209
209210 /*
@@ -228,9 +229,9 @@ public int compareTo(Object obj) {
228229
229230 // It's safe to compare directly against key and value,
230231 // because they are validated not to be null on instance creation.
231- int keyCompare = this .key .toLowerCase ().compareTo (that .key .toLowerCase ());
232+ int keyCompare = this .key .toLowerCase (Locale . ROOT ).compareTo (that .key .toLowerCase (Locale . ROOT ));
232233 if (keyCompare == 0 ) {
233- return this .value .toLowerCase ().compareTo (that .value .toLowerCase ());
234+ return this .value .toLowerCase (Locale . ROOT ).compareTo (that .value .toLowerCase (Locale . ROOT ));
234235 }
235236 else {
236237 return keyCompare ;
0 commit comments