-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.2.0
-
sparc
-
solaris_2.5
Name: avC70361 Date: 06/10/98
The java.util.Locale.toString method works wrong when its language and variant
fields are not empty and country field is empty. The method doesn't show
variant field, although the language field is not empty (the only condition provided
in the specs not to show the variant field is when both language and country fields
are empty).
here is a test demonstrating the bug.
-----------LocaleToStringTest.java--------
import java.util.Locale;
public class LocaleToStringTest {
public static void main(String args[]) {
String language = "en";
String country = "";
String variant = "WIN";
Locale locale = new Locale(language, country, variant);
String result = locale.toString();
if (!result.equals(language + "_" + variant)) {
System.out.println(
"Failed: Locale.toString() returns wrong result : \""
+ result + "\"\n"
+ "for a locale with language \"" + language + "\""
+ ", country \"" + country + "\""
+ " and variant \"" + variant + "\""
);
} else {
System.out.println("Passed");
}
}
}
-----------The test output-----------
> java LocaleToStringTest
Failed: Locale.toString() returns wrong result : "en"
for a locale with language "en", country "" and variant "WIN"
======================================================================
- duplicates
-
JDK-4139504 Locale.toString(de_POSIX) broken
-
- Closed
-