Skip to content

Commit ea06b5c

Browse files
committed
8321480: ISO 4217 Amendment 176 Update
Reviewed-by: goetz Backport-of: 223018a3aabc319992d9790fa1d6c88b02fcca9f
1 parent 776f1e3 commit ea06b5c

File tree

5 files changed

+27
-18
lines changed

5 files changed

+27
-18
lines changed

make/data/currency/CurrencyData.properties

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

35-
dataVersion=175
35+
dataVersion=176
3636

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

@@ -189,11 +189,11 @@ CR=CRC
189189
# COTE D'IVOIRE
190190
CI=XOF
191191
# CROATIA
192-
HR=HRK;2022-12-31-23-00-00;EUR
192+
HR=EUR
193193
# CUBA
194194
CU=CUP
195195
# Cura\u00e7ao
196-
CW=ANG
196+
CW=ANG;2025-04-01-04-00-00;XCG
197197
# CYPRUS
198198
CY=EUR
199199
# CZECHIA
@@ -510,7 +510,7 @@ SR=SRD
510510
# SVALBARD AND JAN MAYEN
511511
SJ=NOK
512512
# Sint Maarten (Dutch part)
513-
SX=ANG
513+
SX=ANG;2025-04-01-04-00-00;XCG
514514
# ESWATINI
515515
SZ=SZL
516516
# SWEDEN

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2016, 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,6 +30,7 @@
3030
import java.io.DataOutputStream;
3131
import java.io.FileOutputStream;
3232
import java.text.SimpleDateFormat;
33+
import java.util.Arrays;
3334
import java.util.Date;
3435
import java.util.HashMap;
3536
import java.util.Locale;
@@ -312,9 +313,15 @@ private static void buildOtherTables() {
312313
validCurrencyCodes.substring(i * 7 + 3, i * 7 + 6));
313314
checkCurrencyCode(currencyCode);
314315
int tableEntry = mainTable[(currencyCode.charAt(0) - 'A') * A_TO_Z + (currencyCode.charAt(1) - 'A')];
315-
if (tableEntry == INVALID_COUNTRY_ENTRY ||
316-
(tableEntry & SPECIAL_CASE_COUNTRY_MASK) != 0 ||
317-
(tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK) != (currencyCode.charAt(2) - 'A')) {
316+
317+
// Do not allow a future currency to be classified as an otherCurrency,
318+
// otherwise it will leak out into Currency:getAvailableCurrencies
319+
boolean futureCurrency = Arrays.asList(specialCaseNewCurrencies).contains(currencyCode);
320+
boolean simpleCurrency = (tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK) == (currencyCode.charAt(2) - 'A');
321+
322+
// If neither a simple currency, or one defined in the future
323+
// then the current currency is applicable to be added to the otherTable
324+
if (!futureCurrency && !simpleCurrency) {
318325
if (otherCurrenciesCount == maxOtherCurrencies) {
319326
throw new RuntimeException("too many other currencies");
320327
}

src/java.base/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

test/jdk/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
* 8039317 8074350 8074351 8145952 8187946 8193552 8202026 8204269
27-
* 8208746 8209775 8264792 8274658 8283277 8296239
27+
* 8208746 8209775 8264792 8274658 8283277 8296239 8321480
2828
* @summary Validate ISO 4217 data for Currency class.
2929
* @modules java.base/java.util:open
3030
* jdk.localedata
@@ -100,7 +100,7 @@ public class ValidateISO4217 {
100100
/* Codes that are obsolete, do not have related country, extra currency */
101101
static final String otherCodes =
102102
"ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-BYR-CHE-CHW-CLF-COU-CUC-CYP-"
103-
+ "DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LTL-LUF-LVL-MGF-MRO-MTL-MXV-MZM-NLG-"
103+
+ "DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-HRK-IEP-ITL-LTL-LUF-LVL-MGF-MRO-MTL-MXV-MZM-NLG-"
104104
+ "PTE-ROL-RUR-SDD-SIT-SLL-SKK-SRG-STD-TMM-TPE-TRL-VEF-UYI-USN-USS-VEB-VED-"
105105
+ "XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-"
106106
+ "YUM-ZMK-ZWD-ZWN-ZWR";

test/jdk/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=3
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)