-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
7
-
x86
-
windows_xp
FULL PRODUCT VERSION :
Java 7, update 1, update 2
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The introduction in Java 7 of Locale.Category has led to a serious backward compatibility problem.
I have an US English license of Windows XP running on my system, regionally configured as Italian (Switzerland).
With Java <= 1.6, System.out.println(Locale.getDefault()) gives "it_CH", which is correct.
Now Java 1.7 for the same command gives "en_US"; the same happens with System.out.println(Locale.getDefault(Locale.Category.DISPLAY))
(which I assume is the default value when calling the plain getDefault() method), while System.out.println(Locale.getDefault(Locale.Category.FORMAT))
produces "it_CH".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Invoke
System.out.println(java.util.Locale.getDefault());
on two systems, one running Java 6 (or older) and the other running Java 7
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
java.util.Locale.getDefault() should return the regionally configured locale
ACTUAL -
java.util.Locale.getDefault() returns the system's locale, regardless of the regional settings
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Add code to my localized programs in order to determine the correct locale to use in a mixed java versions scenario, compile them with javac 1.7 with the -source and -target flags set to 1.6 (and tolerate the compiler warnings); something like:
Locale localeToUse;
if (System.getProperty("java.runtime.version").startsWith("1.7")) {
localeToUse = Locale.getDefault(Locale.Category.FORMAT);
} else {
localeToUse = Locale.getDefault();
}
Java 7, update 1, update 2
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The introduction in Java 7 of Locale.Category has led to a serious backward compatibility problem.
I have an US English license of Windows XP running on my system, regionally configured as Italian (Switzerland).
With Java <= 1.6, System.out.println(Locale.getDefault()) gives "it_CH", which is correct.
Now Java 1.7 for the same command gives "en_US"; the same happens with System.out.println(Locale.getDefault(Locale.Category.DISPLAY))
(which I assume is the default value when calling the plain getDefault() method), while System.out.println(Locale.getDefault(Locale.Category.FORMAT))
produces "it_CH".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Invoke
System.out.println(java.util.Locale.getDefault());
on two systems, one running Java 6 (or older) and the other running Java 7
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
java.util.Locale.getDefault() should return the regionally configured locale
ACTUAL -
java.util.Locale.getDefault() returns the system's locale, regardless of the regional settings
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Add code to my localized programs in order to determine the correct locale to use in a mixed java versions scenario, compile them with javac 1.7 with the -source and -target flags set to 1.6 (and tolerate the compiler warnings); something like:
Locale localeToUse;
if (System.getProperty("java.runtime.version").startsWith("1.7")) {
localeToUse = Locale.getDefault(Locale.Category.FORMAT);
} else {
localeToUse = Locale.getDefault();
}
- relates to
-
JDK-4700857 RFE: separating user locale and user interface locale
- Closed