JDK-7039901 : JDK7 doesn't see the correct default locale
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic,windows_7
  • CPU: generic,x86
  • Submitted: 2011-04-27
  • Updated: 2011-09-22
  • Resolved: 2011-04-29
Related Reports
Duplicate :  
Relates :  
Description
Found while running Eclipse, and Mission control on a computer with swedish locale.  Timestamps use the us format: "8.45AM" instead of the swedish "08.45".

Java repro:
import java.util.Locale;


public class LocaleDefaultTest {
       public static void main(String[] args) {
              System.out.println(Locale.getDefault());
    }
}

On my computer it will print out "sv_SE" with jdk6 and "en_US" with jdk7-137.
Windows 7, x64 computer.

Comments
EVALUATION I wrote a simple sample below and run on Windows with "Format" set to Swedish (Sweden): DateFormat df1 = DateFormat.getTimeInstance(DateFormat.SHORT); DateFormat df2 = DateFormat.getTimeInstance(DateFormat.MEDIUM); DateFormat df3 = DateFormat.getTimeInstance(DateFormat.LONG); DateFormat df4 = DateFormat.getTimeInstance(DateFormat.FULL); Date d = new Date(); System.out.printf("short: %s\nmedium: %s\nlong: %s\nfull: %s\n", df1.for mat(d), df2.format(d), df3.format(d), df4.format(d)); And the output is: short: 08:55 medium: 08:55:15 long: 08:55:15 PDT full: kl 8:55 PDT which is exactly the same result with JDK6, i.e., derived from the "Format" locale. I am assuming the time format in the description is produced by the applicaiton (Eclipse?) itself. So I am closing this CR as the result is the expected behavior.
29-04-2011

EVALUATION Yes, running english windows with swedish locale. No UI languages installed, so I guess en_US is implicit. This was found using Eclipse 3.6, which isn't updated for JDK7, so that might matter. But if I'm reading you correctly, the time format should still be derived from the "Format"/locale, so this is still an error? Otherwise I guess this can be closed.
29-04-2011

EVALUATION Can you please give the information on locale settings in your machine? Especially the "Region and Language" Settings in the Control Panel? Do you have English Windows and your "Format" is set to Swedish? As of JDK7, the default locale returned from Locale.getDefault() is now derived from the "Display language" in "Keyboards and Languages" tab in "Region and Language" per the change for the RFE 4700857. The "Display language" list only appears in the Multilingual UI environemnt, so if you just have English Windows without installing any other UI languages, the "Display language" is implicitly en_US. What I find strange here is that the timestamp format was also changed from Swedish format to US format. The default locale for those formatting services, such as DateFormat/NumberFormat/CurrencyFormat is still derived from what's specified in the "Format" list in the Control Panel in JDK7, i.e., Swedish if my assumption for your machine settings are correct. Does the timestamp produced using Java's formatting functionality, or crafted by the application by its own way?
27-04-2011