19
19
import java .io .Serializable ;
20
20
import java .net .URI ;
21
21
import java .net .URISyntaxException ;
22
+ import java .util .Locale ;
22
23
23
24
import org .slf4j .Logger ;
24
25
import org .slf4j .LoggerFactory ;
@@ -75,10 +76,10 @@ public LdapRdnComponent(String key, String value, boolean decodeValue) {
75
76
76
77
String caseFold = System .getProperty (DistinguishedName .KEY_CASE_FOLD_PROPERTY );
77
78
if (!StringUtils .hasText (caseFold ) || caseFold .equals (DistinguishedName .KEY_CASE_FOLD_LOWER )) {
78
- this .key = key .toLowerCase ();
79
+ this .key = key .toLowerCase (Locale . ROOT );
79
80
}
80
81
else if (caseFold .equals (DistinguishedName .KEY_CASE_FOLD_UPPER )) {
81
- this .key = key .toUpperCase ();
82
+ this .key = key .toUpperCase (Locale . ROOT );
82
83
}
83
84
else if (caseFold .equals (DistinguishedName .KEY_CASE_FOLD_NONE )) {
84
85
this .key = key ;
@@ -88,7 +89,7 @@ else if (caseFold.equals(DistinguishedName.KEY_CASE_FOLD_NONE)) {
88
89
+ "; expected \" " + DistinguishedName .KEY_CASE_FOLD_LOWER + "\" , \" "
89
90
+ DistinguishedName .KEY_CASE_FOLD_UPPER + "\" , or \" " + DistinguishedName .KEY_CASE_FOLD_NONE
90
91
+ "\" " );
91
- this .key = key .toLowerCase ();
92
+ this .key = key .toLowerCase (Locale . ROOT );
92
93
}
93
94
if (decodeValue ) {
94
95
this .value = LdapEncoder .nameDecode (value );
@@ -203,7 +204,7 @@ public boolean equals(Object obj) {
203
204
*/
204
205
@ Override
205
206
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 ();
207
208
}
208
209
209
210
/*
@@ -228,9 +229,9 @@ public int compareTo(Object obj) {
228
229
229
230
// It's safe to compare directly against key and value,
230
231
// 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 ));
232
233
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 ));
234
235
}
235
236
else {
236
237
return keyCompare ;
0 commit comments