Skip to content

Commit 439e910

Browse files
Karmjerboaa
authored andcommitted
8321480: ISO 4217 Amendment 176 Update
Reviewed-by: sgehwolf Backport-of: ea06b5c966e9261cacb35300ddde6eae48ec632f
1 parent edbdf05 commit 439e910

File tree

5 files changed

+27
-19
lines changed

5 files changed

+27
-19
lines changed

jdk/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
3030
import java.io.DataOutputStream;
3131
import java.io.FileOutputStream;
3232
import java.text.SimpleDateFormat;
33-
import java.util.Date;
33+
import java.util.Arrays;
3434
import java.util.HashMap;
3535
import java.util.Locale;
3636
import java.util.Properties;
@@ -311,9 +311,15 @@ private static void buildOtherTables() {
311311
validCurrencyCodes.substring(i * 7 + 3, i * 7 + 6));
312312
checkCurrencyCode(currencyCode);
313313
int tableEntry = mainTable[(currencyCode.charAt(0) - 'A') * A_TO_Z + (currencyCode.charAt(1) - 'A')];
314-
if (tableEntry == INVALID_COUNTRY_ENTRY ||
315-
(tableEntry & SPECIAL_CASE_COUNTRY_MASK) != 0 ||
316-
(tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK) != (currencyCode.charAt(2) - 'A')) {
314+
315+
// Do not allow a future currency to be classified as an otherCurrency,
316+
// otherwise it will leak out into Currency:getAvailableCurrencies
317+
boolean futureCurrency = Arrays.asList(specialCaseNewCurrencies).contains(currencyCode);
318+
boolean simpleCurrency = (tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK) == (currencyCode.charAt(2) - 'A');
319+
320+
// If neither a simple currency, or one defined in the future
321+
// then the current currency is applicable to be added to the otherTable
322+
if (!futureCurrency && !simpleCurrency) {
317323
if (otherCurrenciesCount == maxOtherCurrencies) {
318324
throw new RuntimeException("too many other currencies");
319325
}

jdk/src/share/classes/java/util/CurrencyData.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ formatVersion=2
3131
# Version of the currency code information in this class.
3232
# It is a serial number that accompanies with each amendment.
3333

34-
dataVersion=175
34+
dataVersion=176
3535

3636
# List of all valid ISO 4217 currency codes.
3737
# To ensure compatibility, do not remove codes.
@@ -54,7 +54,7 @@ all=ADP020-AED784-AFA004-AFN971-ALL008-AMD051-ANG532-AOA973-ARS032-ATS040-AUD036
5454
SRD968-SRG740-SSP728-STD678-STN930-SVC222-SYP760-SZL748-THB764-TJS972-TMM795-TMT934-TND788-TOP776-\
5555
TPE626-TRL792-TRY949-TTD780-TWD901-TZS834-UAH980-UGX800-USD840-USN997-USS998-UYI940-\
5656
UYU858-UZS860-VEB862-VED926-VEF937-VES928-VND704-VUV548-WST882-XAF950-XAG961-XAU959-XBA955-\
57-
XBB956-XBC957-XBD958-XCD951-XDR960-XFO000-XFU000-XOF952-XPD964-XPF953-\
57+
XBB956-XBC957-XBD958-XCD951-XCG532-XDR960-XFO000-XFU000-XOF952-XPD964-XPF953-\
5858
XPT962-XSU994-XTS963-XUA965-XXX999-YER886-YUM891-ZAR710-ZMK894-ZMW967-ZWD716-ZWL932-\
5959
ZWN942-ZWR935
6060

@@ -188,11 +188,11 @@ CR=CRC
188188
# COTE D'IVOIRE
189189
CI=XOF
190190
# CROATIA
191-
HR=HRK;2022-12-31-23-00-00;EUR
191+
HR=EUR
192192
# CUBA
193193
CU=CUP
194194
# Cura\u00e7ao
195-
CW=ANG
195+
CW=ANG;2025-04-01-04-00-00;XCG
196196
# CYPRUS
197197
CY=EUR
198198
# CZECHIA
@@ -507,7 +507,7 @@ SR=SRD
507507
# SVALBARD AND JAN MAYEN
508508
SJ=NOK
509509
# Sint Maarten (Dutch part)
510-
SX=ANG
510+
SX=ANG;2025-04-01-04-00-00;XCG
511511
# ESWATINI
512512
SZ=SZL
513513
# SWEDEN

jdk/src/share/classes/sun/util/resources/CurrencyNames.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -266,6 +266,7 @@ XBB=XBB
266266
XBC=XBC
267267
XBD=XBD
268268
XCD=XCD
269+
XCG=XCG
269270
XDR=XDR
270271
XFO=XFO
271272
XFU=XFU
@@ -491,6 +492,7 @@ xbb=European Monetary Unit
491492
xbc=European Unit of Account (XBC)
492493
xbd=European Unit of Account (XBD)
493494
xcd=East Caribbean Dollar
495+
xcg=Caribbean Guilder
494496
xdr=Special Drawing Rights
495497
xfo=French Gold Franc
496498
xfu=French UIC-Franc

jdk/test/java/util/Currency/ValidateISO4217.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* @test
2525
* @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759
2626
* 8074350 8074351 8145952 8187946 8193552 8202026 8204269
27-
* 8208746 8209775 8274658 8283277 8296239
27+
* 8208746 8209775 8274658 8283277 8296239 8321480
2828
* @summary Validate ISO 4217 data for Currency class.
2929
*/
3030

@@ -95,7 +95,7 @@ public class ValidateISO4217 {
9595
/* Codes that are obsolete, do not have related country, extra currency */
9696
static final String otherCodes =
9797
"ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-BYR-CHE-CHW-CLF-COU-CUC-CYP-"
98-
+ "DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LTL-LUF-LVL-MGF-MRO-MTL-MXV-MZM-NLG-"
98+
+ "DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-HRK-IEP-ITL-LTL-LUF-LVL-MGF-MRO-MTL-MXV-MZM-NLG-"
9999
+ "PTE-ROL-RUR-SDD-SIT-SLL-SKK-SRG-STD-TMM-TPE-TRL-VEF-UYI-USN-USS-VEB-VED-"
100100
+ "XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-"
101101
+ "YUM-ZMK-ZWD-ZWN-ZWR";

jdk/test/java/util/Currency/tablea1.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#
22
#
3-
# Amendments up until ISO 4217 AMENDMENT NUMBER 175
4-
# (As of 31 March 2023)
3+
# Amendments up until ISO 4217 AMENDMENT NUMBER 176
4+
# (As of 06 December 2023)
55
#
66

77
# Version
88
FILEVERSION=2
9-
DATAVERSION=175
9+
DATAVERSION=176
1010

1111
# ISO 4217 currency data
1212
AF AFN 971 2
@@ -67,9 +67,9 @@ CD CDF 976 2
6767
CK NZD 554 2
6868
CR CRC 188 2
6969
CI XOF 952 0
70-
HR HRK 191 2 2022-12-31-23-00-00 EUR 978 2
70+
HR EUR 978 2
7171
CU CUP 192 2
72-
CW ANG 532 2
72+
CW ANG 532 2 2025-04-01-04-00-00 XCG 532 2
7373
CY EUR 978 2
7474
CZ CZK 203 2
7575
DK DKK 208 2
@@ -233,7 +233,7 @@ LK LKR 144 2
233233
SD SDG 938 2
234234
SR SRD 968 2
235235
SJ NOK 578 2
236-
SX ANG 532 2
236+
SX ANG 532 2 2025-04-01-04-00-00 XCG 532 2
237237
SZ SZL 748 2
238238
SE SEK 752 2
239239
CH CHF 756 2

0 commit comments

Comments
 (0)