FULL PRODUCT VERSION :
1.6.0
ADDITIONAL OS VERSION INFORMATION :
Windows XP and other
A DESCRIPTION OF THE PROBLEM :
Locale.getAvaillabelLocales has Locale sh_Cyrl_RS.
Creating a Locale with
new Locale("sh", "Cyrl", "RS") and calling toString() shows
sh_CYRL_RS
(country in uppercase letters);
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
for (int iLoop =0; iLoop < availlableLocales.length; iLoop++){
Locale actLocale = availlableLocales[iLoop];
assertEquals(actLocale, LocaleProvider.resolveLocale(actLocale.toString()));
}
// class localeprovider, needed for difficulties with IBM-JDK
private LocaleProvider() {
}
public static Locale resolveLocale(String language) {
Locale resultLocale = null;
if (language != null && language.length()>0 ) {
int underScore = language.indexOf("_");
if (underScore == -1) {
resultLocale = new Locale (language.toLowerCase(),"");
}
else {
String lang = language.substring(0, underScore);
String country = language.substring(underScore+1);
String variant = "";
if ((underScore=country.indexOf('_')) > -1) {
variant = country.substring(underScore+1);
country = country.substring(0, underScore);
}
resultLocale = new Locale(lang, country, variant);
}
if (resultLocale==null) {
resultLocale = Locale.ENGLISH;
}
}
return resultLocale;
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
sh_Cyrl_RS
ACTUAL -
sh_CYRL_RS
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
look above
---------- END SOURCE ----------