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

CurrencyFormat produces different code point after Java 13 build 21

XMLWordPrintable

    • b21
    • 13
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      $ uname -a
      Linux martin-tuxedo 5.0.0-15-generic #16-Ubuntu SMP Mon May 6 17:41:33 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

      $ /home/martin/devel/jdk-13/bin/java -version
      openjdk version "13-ea" 2019-09-17
      OpenJDK Runtime Environment (build 13-ea+23)
      OpenJDK 64-Bit Server VM (build 13-ea+23, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      Testing Java 13 build 23 with Apache Wicket led to a test failure in formatting a string like "1\u00A0234,00\u00A0\u00A4" with CurrencyFormat with Locale.FRENCH. The test was passing with Java 13 build 18 and earlier versions of Java (12, 11, ...).
      The problem is that the result String has different code point on the second position: 8239 for Java 13 b23 vs. 160 for any earlier version of Java

      REGRESSION : Last worked in version 13

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute the code below with Java 13 build 23 and any previous build:


      ACTUAL -
      false

      ---------- BEGIN SOURCE ----------

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

      public class Java13Regression2
      {

      public static void main(String[] args)
      {
      final NumberFormat numberFormat = NumberFormat.getCurrencyInstance(Locale.FRENCH);
      ((DecimalFormat)numberFormat).setParseBigDecimal(true);
      // \u00A0 = nbsp
      // \u00A4 = currency symbol (unspecified currency)
      String string = "1\u00A0234,00\u00A0\u00A4";
      final String formatted = numberFormat.format(1234f);

      formatted.codePoints().forEach(cp -> System.err.println(cp));

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

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

      FREQUENCY : always


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

              Created:
              Updated:
              Resolved: