JDK-8225650 : CurrencyFormat produces different code point after Java 13 build 21
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Priority: P3
  • Status: Resolved
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2019-06-12
  • Updated: 2019-06-17
  • Resolved: 2019-06-12
Related Reports
Relates :  
Description
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
Comments
The sample is incorrectly expecting that the space between the number and the currency symbol is the same as the grouping separator. It's not a grouping separator but a NBSP.
12-06-2019

This issue started from JDK 13 b21, due to CLDR version upgrade (JDK-8221432). JDK 13-ea + 20- Pass JDK 13-ea + 21 - Fail JDK 13-ea + 24 - Fail Output on passing versions : 49 160 50 51 52 44 48 48 160 164 true Output on failing versions : 49 8239 50 51 52 44 48 48 160 164 false
12-06-2019