JDK-8225247 : CurrencyFormat produces different code point after Java 13 build 21
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 13
  • Priority: P2
  • Status: Resolved
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2019-06-04
  • Updated: 2019-07-17
  • Resolved: 2019-06-04
Related Reports
Relates :  
Relates :  
Description
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



Comments
CLDR has changed the grouping separator for French in v34, from U+00A0 to U+202F: https://www.unicode.org/cldr/charts/34/delta/fr.html#Symbols JDK has been based on v35.1 since b21 (JDK-8221432), thus the applications that expect the French grouping separator to be U+00A0 will not work. Instead of hardcoding \u00A0, applications can use DecimalFormatSymbols.getInstance(Locale.FRENCH).getGroupingSeparator().
04-06-2019

This issue also started from JDK 13 b21, most likely due to CLDR version upgrade (JDK-8221432). JDK 13-ea + 20- Pass JDK 13-ea + 21 - Fail JDK 13-ea + 22 - 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
04-06-2019