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

German (Switzerland) formatting broken if CLDR Locale Data is used

    XMLWordPrintable

Details

    • b77
    • x86_64
    • windows_7
    • Verified

    Backports

      Description

        FULL PRODUCT VERSION :
        java version "1.9.0-ea"
        Java(TM) SE Runtime Environment (build 1.9.0-ea-b72)
        Java HotSpot(TM) Client VM (build 1.9.0-ea-b72, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Windows 7 64-bit

        A DESCRIPTION OF THE PROBLEM :
        Ever since CLDR Locale Data is used by default (i.e. since 1.9.0-ea-b71, see JDK-8008577), German (Switzerland) formatting is broken. Numbers are formatted as for German (Germany).

        A correct number for de_CH: 54'839'483.142
        vs. actual 54.839.483,142

        REGRESSION. Last worked in version 8u51

        ADDITIONAL REGRESSION INFORMATION:
        java version "1.8.0_51"
        Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
        Java HotSpot(TM) Client VM (build 25.51-b03, mixed mode)

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Execute the test case

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Output of the test case should be:

        correct for de_CH: 54'839'483.142 vs. actual 54'839'483.142

        (i.e. actual format matches the expected format)
        ACTUAL -
        Output of the test case is:

        correct for de_CH: 54'839'483.142 vs. actual 54.839.483,142

        (i.e. actual format does NOT match the expected, correct number format for German (Switzerland)

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.text.NumberFormat;
        import java.util.Locale;

        public class Cldr {
          
          public static void main(String[] args) {
            Locale deCH = new Locale("de", "CH");
            NumberFormat nf = NumberFormat.getInstance(deCH);
            
            String expected = "54'839'483.142"; // i.e. "." as decimal separator, "'" as grouping separator
            String actual = nf.format(54839483.1415);
            System.out.println("correct for de_CH: " + expected + " vs. actual " + actual);
          }
          
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Pass -Djava.locale.providers=JRE,SPI to avoid CLDR Locale Data being used

        Attachments

          Issue Links

            Activity

              People

                naoto Naoto Sato
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: