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

CurrencyFormat produces different code point after Java 13 build 21

XMLWordPrintable

    • b21
    • 13
    • generic
    • generic

      It's a followup bug of JDK-8225247.

       java version "13-ea" 2019-09-17
      Java(TM) SE Runtime Environment (build 13-ea+21)
      Java HotSpot(TM) 64-Bit Server VM (build 13-ea+21, mixed mode, sharing)


      Test case:
       import static java.lang.String.format;

      import java.text.DecimalFormat;
      import java.text.DecimalFormatSymbols;
      import java.text.NumberFormat;
      import java.util.Locale;

      public class Java13Regression2
      {

      public static void main(String[] args)
      {
      final Locale locale = Locale.FRENCH;
      final NumberFormat numberFormat = NumberFormat.getCurrencyInstance(locale);
      ((DecimalFormat) numberFormat).setParseBigDecimal(true);
      final DecimalFormatSymbols decimalFormatSymbols = DecimalFormatSymbols.getInstance(locale);
      char groupingSeparator = decimalFormatSymbols.getGroupingSeparator();
      String currencySymbol = decimalFormatSymbols.getCurrencySymbol();

      String expected = format("1%s234,00%s%s", groupingSeparator, groupingSeparator, currencySymbol); // <<<<< HERE
      final String formatted = numberFormat.format(1234f);

      formatted.codePoints().forEach(System.err::println);

      // prints true for Java 13 build 20 and earlier (Java 12, 11, ...)
      // But prints false for Java 13 build 21
      System.out.println(expected.equals(formatted));
      }
      }

      Expected/Actual Output:
      prints true for Java 13 build 20 and earlier (Java 12, 11, ...)
      But prints false for Java 13 build 21

            naoto Naoto Sato
            akolarkunnu Abdul Kolarkunnu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: