From 1ed3717f5a226981a1ebeff70dcafadc74569190 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Fri, 4 Sep 2026 13:33:48 +0000 Subject: [PATCH] 8390388: Cherry-pick tz attributes from newer CLDR data for jdk25u and earlier Backport-of: b367e720927d1916abe446acd7b1c9c31c68745a --- .../data/cldr/common/dtd/ldmlSupplemental.dtd | 6 ++++++ .../cldr/common/supplemental/metaZones.xml | 8 ++++---- .../format/TestZoneTextPrinterParser.java | 19 +++++++++++++------ .../resources/cldr/TimeZoneNamesTest.java | 6 ++---- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/make/data/cldr/common/dtd/ldmlSupplemental.dtd b/make/data/cldr/common/dtd/ldmlSupplemental.dtd index e0258ed7f34b..e22c59401e9c 100644 --- a/make/data/cldr/common/dtd/ldmlSupplemental.dtd +++ b/make/data/cldr/common/dtd/ldmlSupplemental.dtd @@ -927,6 +927,12 @@ Except as contained in this notice, the name of a copyright holder shall not be + + + + + + diff --git a/make/data/cldr/common/supplemental/metaZones.xml b/make/data/cldr/common/supplemental/metaZones.xml index 6e22fb49160e..efc8f569159b 100644 --- a/make/data/cldr/common/supplemental/metaZones.xml +++ b/make/data/cldr/common/supplemental/metaZones.xml @@ -187,7 +187,7 @@ For terms of use, see http://www.unicode.org/copyright.html - + @@ -753,7 +753,7 @@ For terms of use, see http://www.unicode.org/copyright.html - + @@ -1241,8 +1241,8 @@ For terms of use, see http://www.unicode.org/copyright.html - - + + diff --git a/test/jdk/java/time/test/java/time/format/TestZoneTextPrinterParser.java b/test/jdk/java/time/test/java/time/format/TestZoneTextPrinterParser.java index 04253f3e94b4..b9dc3874caf1 100644 --- a/test/jdk/java/time/test/java/time/format/TestZoneTextPrinterParser.java +++ b/test/jdk/java/time/test/java/time/format/TestZoneTextPrinterParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,6 +50,7 @@ /* * @test * @bug 8081022 8151876 8166875 8189784 8206980 8278434 + * 8390388 * @key randomness */ @@ -86,10 +87,16 @@ public void test_printText() { } zdt = zdt.withZoneSameLocal(ZoneId.of(zid)); TimeZone tz = TimeZone.getTimeZone(zid); - boolean isDST = tz.inDaylightTime(new Date(zdt.toInstant().toEpochMilli())); + long epochMilli = zdt.toInstant().toEpochMilli(); + boolean isDST = tz.inDaylightTime(new Date(epochMilli)); + // Some zones now use an explicit daylight offset in CLDR without java.util.TimeZone + // reporting DST for the instant, so prefer the daylight name when the effective + // offset is greater than the raw standard offset. + boolean useDaylightName = isDST + || (tz.getDSTSavings() == 0 && tz.getOffset(epochMilli) > tz.getRawOffset()); for (Locale locale : SAMPLE_LOCALES) { - String longDisplayName = tz.getDisplayName(isDST, TimeZone.LONG, locale); - String shortDisplayName = tz.getDisplayName(isDST, TimeZone.SHORT, locale); + String longDisplayName = tz.getDisplayName(useDaylightName, TimeZone.LONG, locale); + String shortDisplayName = tz.getDisplayName(useDaylightName, TimeZone.SHORT, locale); if ((longDisplayName.startsWith("GMT+") && shortDisplayName.startsWith("GMT+")) || (longDisplayName.startsWith("GMT-") && shortDisplayName.startsWith("GMT-"))) { printText(locale, zdt, TextStyle.FULL, tz, tz.getID()); @@ -97,9 +104,9 @@ public void test_printText() { continue; } printText(locale, zdt, TextStyle.FULL, tz, - tz.getDisplayName(isDST, TimeZone.LONG, locale)); + tz.getDisplayName(useDaylightName, TimeZone.LONG, locale)); printText(locale, zdt, TextStyle.SHORT, tz, - tz.getDisplayName(isDST, TimeZone.SHORT, locale)); + tz.getDisplayName(useDaylightName, TimeZone.SHORT, locale)); } } } diff --git a/test/jdk/sun/util/resources/cldr/TimeZoneNamesTest.java b/test/jdk/sun/util/resources/cldr/TimeZoneNamesTest.java index 29dca4acdfa1..576788f2948d 100644 --- a/test/jdk/sun/util/resources/cldr/TimeZoneNamesTest.java +++ b/test/jdk/sun/util/resources/cldr/TimeZoneNamesTest.java @@ -24,7 +24,7 @@ /* * @test * @bug 8181157 8202537 8234347 8236548 8261279 8293834 - * 8381379 + * 8381379 8390388 * @modules jdk.localedata * @summary Checks CLDR time zone names are generated correctly at runtime * @run junit/othervm -Djava.locale.providers=CLDR TimeZoneNamesTest @@ -208,9 +208,7 @@ private static Stream explicitDstOffsets() { Arguments.of(ZonedDateTime.of(2026, 4, 5, 0, 0, 0, 0, ZoneId.of("Eire")), "Irish Standard Time"), Arguments.of(ZonedDateTime.of(2026, 12, 5, 0, 0, 0, 0, ZoneId.of("Eire")), "Greenwich Mean Time"), Arguments.of(ZonedDateTime.of(2026, 4, 5, 0, 0, 0, 0, ZoneId.of("America/Vancouver")), "Pacific Daylight Time"), - // This needs to change once TZDB adopts -7 offset year round, and CLDR uses explicit dst offset - // namely, "Pacific Standard Time" -> "Pacific Daylight Time" - Arguments.of(ZonedDateTime.of(2026, 12, 5, 0, 0, 0, 0, ZoneId.of("America/Vancouver")), "Pacific Standard Time") + Arguments.of(ZonedDateTime.of(2026, 12, 5, 0, 0, 0, 0, ZoneId.of("America/Vancouver")), "Pacific Daylight Time") ); }