Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8236495

open/test/jdk/java/util/Locale/LocaleProvidersRun.java failed on mac 10.14 with de_DE locale.

XMLWordPrintable

    • b31
    • x86_64
    • os_x

        Test jdk: Oracle jdk 14 build 28
        OS: Mac mini 10.14 with de_DE locale
        Error log:
        Exception in thread "main" java.lang.RuntimeException: Incorrect number format. input: 123.4, expected: 123.4, result: 123,4
        at LocaleProviders.lambda$bug8232860Test$0(LocaleProviders.java:353)
        at java.base/java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:104)
        at java.base/java.util.stream.IntPipeline$Head.forEach(IntPipeline.java:593)
        at LocaleProviders.bug8232860Test(LocaleProviders.java:348)
        at LocaleProviders.main(LocaleProviders.java:92)

        Using following test code to debug:
        public class TestHostProvider{
        public static void main(String[] args){
        NumberFormat numf = NumberFormat.getNumberInstance(Locale.US);
        NumberFormat intf = NumberFormat.getIntegerInstance(Locale.US);
        DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(Locale.US);

        System.out.println("NumberFormat: " + numf.format(123.4));
        System.out.println("IntegerFormat: " + intf.format(1234));

        System.out.println("DecimalSeparator: " + df.getDecimalFormatSymbols().getDecimalSeparator());
        System.out.println("GroupingSeparator: " + df.getDecimalFormatSymbols().getGroupingSeparator());
        }
        }
        When running above test code using HOST provider on mac 10.14 with de_DE locale:
        java -Djava.locale.providers=HOST TestHostProvider
        Expected result:
        NumberFormat: 123.4
        IntegerFormat: 1,234
        DecimalSeparator: .
        GroupingSeparator: ,
        Actual result:
        NumberFormat: 123,4
        IntegerFormat: 1.234
        DecimalSeparator: ,
        GroupingSeparator: .

        The Locale.US in NumberFormat.getNumberInstance(Locale.US), NumberFormat.getIntegerInstance(Locale.US) and DecimalFormat.getInstance(Locale.US) does not work.

              naoto Naoto Sato
              dzhou Dora Zhou (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: