JDK-8230284 : Accounting currency format support does not cope with explicit number system
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 14
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2019-08-28
  • Updated: 2019-09-26
  • Resolved: 2019-09-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 14
14 b14Fixed
Related Reports
Relates :  
Description
Test JDK: jdk 14 build 11

Run following code with -Djava.locale.providers=CLDR:
	public static void main(String[] args) {
		String langTag = "zh-CN-u-nu-arab-cf-account";
		NumberFormat cf = NumberFormat.getCurrencyInstance(Locale.forLanguageTag(langTag));
        String output = cf.format(-1234);
		System.out.println("zh-CN-u-nu-arab-cf-account: " + output);	
		langTag = "ar-SA-u-cf-account";
		cf = NumberFormat.getCurrencyInstance(Locale.forLanguageTag(langTag));
        output = cf.format(-1234);
		System.out.println("ar-SA-u-cf-account: " + output);
	}

Output: Parentheses for negative currency amounts. Please refer to attachment result.jpg.
Expect: Default minus sign for negative currency amounts.

When with CLDR provider specified, for locale "zh-CN-u-nu-arab-cf-account",  "zh_CN" is not supported by CLDR, it falls back to the language only CLDR locale resource (zh.xml)
In CLDR zh.xml:
         <currencyFormats numberSystem="arab">
             <currencyFormatLength>
                 <currencyFormat type="standard">
                     <pattern>��#,##0.00</pattern>
                 </currencyFormat>
                 <currencyFormat type="accounting">
                     <pattern draft="contributed">��#,##0.00</pattern>
                 </currencyFormat>
             </currencyFormatLength>
         </currencyFormats>

Under currencyFormats with "arab" numberSystem, it does not have a explicit pattern for negative currency amounts, my understanding is it should use a minus sign as a default, not a parentheses. 

For locale "ar-SA-u-cf-account", in CLDR ar-SA.xml, no currencyFormats with "arab" numberSystem, based on the CLDR fallback mechanism, it should also use a minus sign as a default. 
Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/b553ad95acf0 User: naoto Date: 2019-09-09 19:43:26 +0000
09-09-2019