|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
@@ -1289,25 +1289,58 @@ private static Map<Locale, String> coverageLevelsMap() throws Exception {
|
1289 | 1289 | */
|
1290 | 1290 | private static void generateTZDBShortNamesMap() throws IOException {
|
1291 | 1291 | Files.walk(Path.of(tzDataDir), 1, FileVisitOption.FOLLOW_LINKS)
|
1292 |
| - .filter(p -> p.toFile().isFile()) |
| 1292 | + .filter(p -> p.toFile().isFile() && !p.endsWith("jdk11_backward")) |
1293 | 1293 | .forEach(p -> {
|
1294 | 1294 | try {
|
1295 | 1295 | String zone = null;
|
1296 | 1296 | String rule = null;
|
1297 | 1297 | String format = null;
|
| 1298 | + boolean inVanguard = false; |
| 1299 | + boolean inRearguard = false; |
1298 | 1300 | for (var line : Files.readAllLines(p)) {
|
1299 |
| - if (line.contains("#STDOFF")) continue; |
| 1301 | + // Interpret the line in rearguard mode so that STD/DST |
| 1302 | + // correctly handles negative DST cases, such as "GMT/IST" |
| 1303 | + // vs. "IST/GMT" case for Europe/Dublin |
| 1304 | + if (inVanguard) { |
| 1305 | + if (line.startsWith("# Rearguard")) { |
| 1306 | + inVanguard = false; |
| 1307 | + inRearguard = true; |
| 1308 | + } |
| 1309 | + continue; |
| 1310 | + } else if (line.startsWith("# Vanguard")) { |
| 1311 | + inVanguard = true; |
| 1312 | + continue; |
| 1313 | + } |
| 1314 | + if (inRearguard) { |
| 1315 | + if (line.startsWith("# End of rearguard")) { |
| 1316 | + inRearguard = false; |
| 1317 | + continue; |
| 1318 | + } else { |
| 1319 | + if (line.startsWith("#\t")) { |
| 1320 | + line = line.substring(1); // omit # |
| 1321 | + } |
| 1322 | + } |
| 1323 | + } |
| 1324 | + if (line.isBlank() || line.matches("^[ \t]*#.*")) { |
| 1325 | + // ignore blank/comment lines |
| 1326 | + continue; |
| 1327 | + } |
| 1328 | + // remove comments in-line |
1300 | 1329 | line = line.replaceAll("[ \t]*#.*", "");
|
1301 | 1330 |
|
1302 | 1331 | // Zone line
|
1303 | 1332 | if (line.startsWith("Zone")) {
|
| 1333 | + if (zone != null) { |
| 1334 | + tzdbShortNamesMap.put(zone, format + NBSP + rule); |
| 1335 | + } |
1304 | 1336 | var zl = line.split("[ \t]+", -1);
|
1305 | 1337 | zone = zl[1];
|
1306 | 1338 | rule = zl[3];
|
1307 | 1339 | format = zl[4];
|
1308 | 1340 | } else {
|
1309 | 1341 | if (zone != null) {
|
1310 |
| - if (line.isBlank()) { |
| 1342 | + if (line.startsWith("Rule") || |
| 1343 | + line.startsWith("Link")) { |
1311 | 1344 | tzdbShortNamesMap.put(zone, format + NBSP + rule);
|
1312 | 1345 | zone = null;
|
1313 | 1346 | rule = null;
|
|
0 commit comments