6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 /*
24 * @test
25 * @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759
26 * 8039317 8074350 8074351 8145952
27 * @summary Validate ISO 4217 data for Currency class.
28 * @modules java.base/java.util:open
29 * jdk.localedata
30 */
31
32 /*
33 * ############################################################################
34 *
35 * ValidateISO4217 is a tool to detect differences between the latest ISO 4217
36 * data and and Java's currency data which is based on ISO 4217.
37 * If there is a difference, the following file which includes currency data
38 * may need to be updated.
39 * src/share/classes/java/util/CurrencyData.properties
40 *
41 * ############################################################################
42 *
43 * 1) Make a golden-data file.
44 * From BSi's ISO4217 data (TABLE A1.doc), extract four (or eight, if currency is changing)
45 * fields and save as ./tablea1.txt.
46 * <Country code>\t<Currency code>\t<Numeric code>\t<Minor unit>[\t<Cutover Date>\t<new Currency code>\t<new Numeric code>\t<new Minor unit>]
78 * Defined in ISO 4217 list, but don't have code and minor unit info in
79 * it. On the othe hand, both code and minor unit are defined in
80 * .properties file. I don't know why, though.
81 */
82 {"GS", "GBP", "826", "2"}, // South Georgia And The South Sandwich Islands
83
84 /* Not defined in ISO 4217 list, but defined in .properties file. */
85 {"AX", "EUR", "978", "2"}, // \u00c5LAND ISLANDS
86 {"PS", "ILS", "376", "2"}, // Palestinian Territory, Occupied
87
88 /* Not defined in ISO 4217 list, but added in ISO 3166 country code list */
89 {"JE", "GBP", "826", "2"}, // Jersey
90 {"GG", "GBP", "826", "2"}, // Guernsey
91 {"IM", "GBP", "826", "2"}, // Isle of Man
92 {"BL", "EUR", "978", "2"}, // Saint Barthelemy
93 {"MF", "EUR", "978", "2"}, // Saint Martin
94 };
95
96 /* Codes that are obsolete, do not have related country */
97 static final String otherCodes =
98 "ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-BYR-CHE-CHW-CLF-COU-CUC-CYP-DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LUF-MGF-MTL-MXV-MZM-NLG-PTE-ROL-RUR-SDD-SIT-SKK-SRG-TMM-TPE-TRL-VEF-UYI-USN-USS-VEB-XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-YUM-ZMK-ZWD-ZWN-ZWR";
99
100 static boolean err = false;
101
102 static Set<Currency> testCurrencies = new HashSet<Currency>();
103
104 public static void main(String[] args) throws Exception {
105 CheckDataVersion.check();
106 test1();
107 test2();
108 getAvailableCurrenciesTest();
109
110 if (err) {
111 throw new RuntimeException("Failed: Validation ISO 4217 data");
112 }
113 }
114
115 static void test1() throws Exception {
116
117 try (FileReader fr = new FileReader(new File(System.getProperty("test.src", "."), datafile));
118 BufferedReader in = new BufferedReader(fr))
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 /*
24 * @test
25 * @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759
26 * 8039317 8074350 8074351 8145952 8187946
27 * @summary Validate ISO 4217 data for Currency class.
28 * @modules java.base/java.util:open
29 * jdk.localedata
30 */
31
32 /*
33 * ############################################################################
34 *
35 * ValidateISO4217 is a tool to detect differences between the latest ISO 4217
36 * data and and Java's currency data which is based on ISO 4217.
37 * If there is a difference, the following file which includes currency data
38 * may need to be updated.
39 * src/share/classes/java/util/CurrencyData.properties
40 *
41 * ############################################################################
42 *
43 * 1) Make a golden-data file.
44 * From BSi's ISO4217 data (TABLE A1.doc), extract four (or eight, if currency is changing)
45 * fields and save as ./tablea1.txt.
46 * <Country code>\t<Currency code>\t<Numeric code>\t<Minor unit>[\t<Cutover Date>\t<new Currency code>\t<new Numeric code>\t<new Minor unit>]
78 * Defined in ISO 4217 list, but don't have code and minor unit info in
79 * it. On the othe hand, both code and minor unit are defined in
80 * .properties file. I don't know why, though.
81 */
82 {"GS", "GBP", "826", "2"}, // South Georgia And The South Sandwich Islands
83
84 /* Not defined in ISO 4217 list, but defined in .properties file. */
85 {"AX", "EUR", "978", "2"}, // \u00c5LAND ISLANDS
86 {"PS", "ILS", "376", "2"}, // Palestinian Territory, Occupied
87
88 /* Not defined in ISO 4217 list, but added in ISO 3166 country code list */
89 {"JE", "GBP", "826", "2"}, // Jersey
90 {"GG", "GBP", "826", "2"}, // Guernsey
91 {"IM", "GBP", "826", "2"}, // Isle of Man
92 {"BL", "EUR", "978", "2"}, // Saint Barthelemy
93 {"MF", "EUR", "978", "2"}, // Saint Martin
94 };
95
96 /* Codes that are obsolete, do not have related country */
97 static final String otherCodes =
98 "ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-BYR-CHE-CHW-CLF-COU-CUC-CYP-"
99 + "DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LUF-MGF-MTL-MXV-MZM-NLG-"
100 + "PTE-ROL-RUR-SDD-SIT-SKK-SRG-STD-TMM-TPE-TRL-VEF-UYI-USN-USS-VEB-"
101 + "XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-"
102 + "YUM-ZMK-ZWD-ZWN-ZWR";
103
104 static boolean err = false;
105
106 static Set<Currency> testCurrencies = new HashSet<Currency>();
107
108 public static void main(String[] args) throws Exception {
109 CheckDataVersion.check();
110 test1();
111 test2();
112 getAvailableCurrenciesTest();
113
114 if (err) {
115 throw new RuntimeException("Failed: Validation ISO 4217 data");
116 }
117 }
118
119 static void test1() throws Exception {
120
121 try (FileReader fr = new FileReader(new File(System.getProperty("test.src", "."), datafile));
122 BufferedReader in = new BufferedReader(fr))
|