Skip to content

Commit 81912e9

Browse files
committedJan 21, 2025
8347841: Test fixes that use deprecated time zone IDs
Reviewed-by: jlu, joehw
1 parent 3d4afc4 commit 81912e9

27 files changed

+179
-146
lines changed
 

‎test/jdk/java/io/File/TimeZoneLastModified.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2025, 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
@@ -23,15 +23,14 @@
2323

2424
/*
2525
* @test
26-
* @bug 6212869
26+
* @bug 6212869 8347841
2727
* @summary Determine if lastModified() works after TimeZone.setDefault()
2828
* @run main/othervm TimeZoneLastModified
2929
*/
3030

3131
import java.io.File;
32-
import java.util.Date;
32+
import java.time.ZoneId;
3333
import java.util.TimeZone;
34-
import java.text.SimpleDateFormat;
3534

3635
public class TimeZoneLastModified {
3736
// Tue, 04 Jun 2002 13:56:50.002 GMT
@@ -40,6 +39,9 @@ public class TimeZoneLastModified {
4039
public static void main(String[] args) throws Throwable {
4140
int failures = test(null);
4241
for (String timeZoneID : TimeZone.getAvailableIDs()) {
42+
if (ZoneId.SHORT_IDS.containsKey(timeZoneID)) {
43+
continue;
44+
}
4345
failures += test(timeZoneID);
4446
}
4547
if (failures != 0) {

‎test/jdk/java/text/Format/DateFormat/DateFormatRegression.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2025, 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
@@ -34,7 +34,7 @@
3434
* @bug 4029195 4052408 4056591 4059917 4060212 4061287 4065240 4071441 4073003
3535
* 4089106 4100302 4101483 4103340 4103341 4104136 4104522 4106807 4108407
3636
* 4134203 4138203 4148168 4151631 4151706 4153860 4162071 4182066 4209272 4210209
37-
* 4213086 4250359 4253490 4266432 4406615 4413980 8008577 8305853 8174269
37+
* 4213086 4250359 4253490 4266432 4406615 4413980 8008577 8305853 8174269 8347841
3838
* @library /java/text/testlib
3939
* @run junit DateFormatRegression
4040
*/
@@ -274,7 +274,7 @@ public void Test4065240() {
274274
try {
275275
Locale curLocale = Locale.GERMANY;
276276
Locale.setDefault(curLocale);
277-
TimeZone.setDefault(TimeZone.getTimeZone("EST"));
277+
TimeZone.setDefault(TimeZone.getTimeZone("America/Panama"));
278278
curDate = new Date(98, 0, 1);
279279
shortdate = DateFormat.getDateInstance(DateFormat.SHORT);
280280
fulldate = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG
@@ -453,7 +453,7 @@ public void Test4413980() {
453453
TimeZone savedTimeZone = TimeZone.getDefault();
454454
try {
455455
boolean pass = true;
456-
String[] IDs = new String[] {"Undefined", "PST", "US/Pacific",
456+
String[] IDs = new String[] {"Undefined", "America/Los_Angeles", "US/Pacific",
457457
"GMT+3:00", "GMT-01:30"};
458458
for (int i = 0; i < IDs.length; i++) {
459459
TimeZone tz = TimeZone.getTimeZone(IDs[i]);
@@ -543,7 +543,7 @@ public void Test4103340() {
543543
public void Test4103341() {
544544
TimeZone saveZone =TimeZone.getDefault();
545545
try {
546-
TimeZone.setDefault(TimeZone.getTimeZone("CST"));
546+
TimeZone.setDefault(TimeZone.getTimeZone("America/Chicago"));
547547
SimpleDateFormat simple = new SimpleDateFormat("MM/dd/yyyy HH:mm");
548548
if (!simple.getTimeZone().equals(TimeZone.getDefault()))
549549
fail("Fail: SimpleDateFormat not using default zone");
@@ -794,7 +794,7 @@ public void Test4406615() {
794794
Locale savedLocale = Locale.getDefault();
795795
TimeZone savedTimeZone = TimeZone.getDefault();
796796
Locale.setDefault(Locale.US);
797-
TimeZone.setDefault(TimeZone.getTimeZone("PST"));
797+
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
798798

799799
Date d1, d2;
800800
String dt = "Mon, 1 Jan 2001 00:00:00";
@@ -1096,7 +1096,7 @@ public void Test4261506() {
10961096

10971097
// XXX: Test assumes "PST" is not TimeZoneNames_ja. Need to
10981098
// pick up another time zone when L10N is done to that file.
1099-
TimeZone.setDefault(TimeZone.getTimeZone("PST"));
1099+
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
11001100
SimpleDateFormat fmt = new SimpleDateFormat("yy/MM/dd hh:ss zzz", Locale.JAPAN);
11011101
@SuppressWarnings("deprecation")
11021102
String result = fmt.format(new Date(1999 - 1900, 0, 1));

‎test/jdk/java/text/Format/DateFormat/DateFormatTest.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, 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
@@ -24,14 +24,16 @@
2424
/**
2525
* @test
2626
* @bug 4052223 4089987 4469904 4326988 4486735 8008577 8045998 8140571
27-
* 8190748 8216969 8174269
27+
* 8190748 8216969 8174269 8347841
2828
* @summary test DateFormat and SimpleDateFormat.
2929
* @modules jdk.localedata
3030
* @run junit DateFormatTest
3131
*/
3232

33-
import java.util.*;
33+
import java.time.ZoneId;
3434
import java.text.*;
35+
import java.util.*;
36+
import java.util.function.Predicate;
3537
import static java.util.GregorianCalendar.*;
3638

3739
import org.junit.jupiter.api.Test;
@@ -89,7 +91,9 @@ public void TestWallyWedel()
8991
/*
9092
* A String array for the time zone ids.
9193
*/
92-
String[] ids = TimeZone.getAvailableIDs();
94+
String[] ids = Arrays.stream(TimeZone.getAvailableIDs())
95+
.filter(Predicate.not(ZoneId.SHORT_IDS::containsKey))
96+
.toArray(String[]::new);
9397
/*
9498
* How many ids do we have?
9599
*/
@@ -183,7 +187,7 @@ public void TestTwoDigitYearDSTParse()
183187
//logln(fmt.format(date)); // This shows what the current locale format is
184188
//logln(((SimpleDateFormat)fmt).toPattern());
185189
TimeZone save = TimeZone.getDefault();
186-
TimeZone PST = TimeZone.getTimeZone("PST");
190+
TimeZone PST = TimeZone.getTimeZone("America/Los_Angeles");
187191
String s = "03-Apr-04 2:20:47 o'clock AM PST";
188192
int hour = 2;
189193
try {
@@ -275,7 +279,7 @@ public void TestFieldPosition()
275279
"0034", "0012", "0513", "Pacific Daylight Time",
276280
};
277281
Date someDate = new Date(871508052513L);
278-
TimeZone PST = TimeZone.getTimeZone("PST");
282+
TimeZone PST = TimeZone.getTimeZone("America/Los_Angeles");
279283
for (int j = 0, exp = 0; j < dateFormats.length; ++j) {
280284
DateFormat df = dateFormats[j];
281285
if (!(df instanceof SimpleDateFormat)) {

‎test/jdk/java/text/Format/DateFormat/SDFTCKZoneNamesTest.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2025, 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
@@ -23,12 +23,13 @@
2323

2424
/**
2525
* @test
26-
* @bug 8218948
26+
* @bug 8218948 8347841
2727
* @summary TCK tests that check the time zone names between DFS.getZoneStrings()
2828
* and SDF.format("z*")
2929
* @run main SDFTCKZoneNamesTest
3030
*/
3131
import java.text.*;
32+
import java.time.ZoneId;
3233
import java.util.Calendar;
3334
import java.util.Date;
3435
import java.util.List;
@@ -325,6 +326,9 @@ public void SimpleDateFormat0062() {
325326
SimpleDateFormat sdf = new SimpleDateFormat();
326327
Date date = new Date(1234567890);
327328
for (String[] tz : sdf.getDateFormatSymbols().getZoneStrings()) {
329+
if (ZoneId.SHORT_IDS.containsKey(tz[0])) {
330+
continue;
331+
}
328332
sdf.setTimeZone(TimeZone.getTimeZone(tz[0]));
329333
for (int i = 0; i < patterns.length && passed; i++) {
330334
StringBuffer result = new StringBuffer("qwerty");

‎test/jdk/java/text/Format/DateFormat/bug4358730.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2025, 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
@@ -31,7 +31,7 @@
3131

3232
/**
3333
* @test
34-
* @bug 4358730
34+
* @bug 4358730 8347841
3535
* @summary test that confirms Zero-Padding on year.
3636
* @run junit bug4358730
3737
*/
@@ -56,7 +56,7 @@ public void Test4358730() {
5656
Locale saveLocale = Locale.getDefault();
5757

5858
try {
59-
TimeZone.setDefault(TimeZone.getTimeZone("PST"));
59+
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
6060
Locale.setDefault(Locale.US);
6161
SimpleDateFormat sdf = new SimpleDateFormat();
6262

‎test/jdk/java/util/Calendar/CalendarRegression.java

+16-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2025, 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
* 4174361 4177484 4197699 4209071 4288792 4328747 4413980 4546637 4623997
3131
* 4685354 4655637 4683492 4080631 4080631 4167995 4340146 4639407
3232
* 4652815 4652830 4740554 4936355 4738710 4633646 4846659 4822110 4960642
33-
* 4973919 4980088 4965624 5013094 5006864 8152077
33+
* 4973919 4980088 4965624 5013094 5006864 8152077 8347841
3434
* @library /java/text/testlib
3535
* @run junit CalendarRegression
3636
*/
@@ -42,6 +42,8 @@
4242
import java.text.DateFormat;
4343
import java.text.NumberFormat;
4444
import java.text.SimpleDateFormat;
45+
import java.time.ZoneId;
46+
import java.util.Arrays;
4547
import java.util.Calendar;
4648
import java.util.Date;
4749
import java.util.GregorianCalendar;
@@ -50,6 +52,7 @@
5052
import java.util.Map;
5153
import java.util.SimpleTimeZone;
5254
import java.util.TimeZone;
55+
import java.util.function.Predicate;
5356

5457
import static java.util.Calendar.*;
5558

@@ -75,7 +78,9 @@ public class CalendarRegression {
7578
public void Test4031502() {
7679
// This bug actually occurs on Windows NT as well, and doesn't
7780
// require the host zone to be set; it can be set in Java.
78-
String[] ids = TimeZone.getAvailableIDs();
81+
String[] ids = Arrays.stream(TimeZone.getAvailableIDs())
82+
.filter(Predicate.not(ZoneId.SHORT_IDS::containsKey))
83+
.toArray(String[]::new);
7984
boolean bad = false;
8085
for (int i = 0; i < ids.length; ++i) {
8186
TimeZone zone = TimeZone.getTimeZone(ids[i]);
@@ -489,7 +494,7 @@ public void Test4095407() {
489494
@Test
490495
public void Test4096231() {
491496
TimeZone GMT = TimeZone.getTimeZone("GMT");
492-
TimeZone PST = TimeZone.getTimeZone("PST");
497+
TimeZone PST = TimeZone.getTimeZone("America/Los_Angeles");
493498
int sec = 0, min = 0, hr = 0, day = 1, month = 10, year = 1997;
494499

495500
Calendar cal1 = new GregorianCalendar(PST);
@@ -838,7 +843,7 @@ public void Test4114578() {
838843
TimeZone saveZone = TimeZone.getDefault();
839844
boolean fail = false;
840845
try {
841-
TimeZone.setDefault(TimeZone.getTimeZone("PST"));
846+
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
842847
Calendar cal = Calendar.getInstance();
843848
long onset = new Date(98, APRIL, 5, 1, 0).getTime() + ONE_HOUR;
844849
long cease = new Date(98, OCTOBER, 25, 0, 0).getTime() + 2 * ONE_HOUR;
@@ -1163,8 +1168,8 @@ public void Test4147269() {
11631168
@Test
11641169
public void Test4149677() {
11651170
TimeZone[] zones = {TimeZone.getTimeZone("GMT"),
1166-
TimeZone.getTimeZone("PST"),
1167-
TimeZone.getTimeZone("EAT")};
1171+
TimeZone.getTimeZone("America/Los_Angeles"),
1172+
TimeZone.getTimeZone("Africa/Addis_Ababa")};
11681173
for (int i = 0; i < zones.length; ++i) {
11691174
GregorianCalendar calendar = new GregorianCalendar(zones[i]);
11701175

@@ -1197,7 +1202,7 @@ public void Test4149677() {
11971202
@Test
11981203
public void Test4162587() {
11991204
TimeZone savedTz = TimeZone.getDefault();
1200-
TimeZone tz = TimeZone.getTimeZone("PST");
1205+
TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
12011206
TimeZone.setDefault(tz);
12021207
GregorianCalendar cal = new GregorianCalendar(tz);
12031208
Date d;
@@ -1511,8 +1516,8 @@ public void Test4174361() {
15111516
*/
15121517
@Test
15131518
public void Test4177484() {
1514-
TimeZone PST = TimeZone.getTimeZone("PST");
1515-
TimeZone EST = TimeZone.getTimeZone("EST");
1519+
TimeZone PST = TimeZone.getTimeZone("America/Los_Angeles");
1520+
TimeZone EST = TimeZone.getTimeZone("America/Panama");
15161521

15171522
Calendar cal = Calendar.getInstance(PST, Locale.US);
15181523
cal.clear();
@@ -1770,7 +1775,7 @@ public void Test4413980() {
17701775
TimeZone savedTimeZone = TimeZone.getDefault();
17711776
try {
17721777
boolean pass = true;
1773-
String[] IDs = new String[]{"Undefined", "PST", "US/Pacific",
1778+
String[] IDs = new String[]{"Undefined", "America/Los_Angeles", "US/Pacific",
17741779
"GMT+3:00", "GMT-01:30"};
17751780
for (int i = 0; i < IDs.length; i++) {
17761781
TimeZone tz = TimeZone.getTimeZone(IDs[i]);

‎test/jdk/java/util/Calendar/JavatimeTest.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2025, 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
@@ -23,7 +23,7 @@
2323

2424
/*
2525
*@test
26-
*@bug 8007520 8008254
26+
*@bug 8007520 8008254 8347841
2727
*@summary Test those bridge methods to/from java.time date/time classes
2828
* @key randomness
2929
*/
@@ -107,23 +107,22 @@ public static void main(String[] args) throws Throwable {
107107

108108
///////////// java.util.TimeZone /////////////////////////
109109
for (String zidStr : TimeZone.getAvailableIDs()) {
110-
// TBD: tzdt intergration
110+
if (ZoneId.SHORT_IDS.containsKey(zidStr)) {
111+
continue;
112+
}
113+
// TBD: tzdt integration
111114
if (zidStr.startsWith("SystemV")
112115
|| zidStr.contains("Riyadh8")
113-
|| zidStr.equals("US/Pacific-New")
114-
|| zidStr.equals("EST")
115-
|| zidStr.equals("HST")
116-
|| zidStr.equals("MST")) {
116+
|| zidStr.equals("US/Pacific-New")) {
117117
continue;
118118
}
119-
ZoneId zid = ZoneId.of(zidStr, ZoneId.SHORT_IDS);
119+
ZoneId zid = ZoneId.of(zidStr);
120120
if (!zid.equals(TimeZone.getTimeZone(zid).toZoneId())) {
121121
throw new RuntimeException("FAILED: zid -> tz -> zid :" + zidStr);
122122
}
123123
TimeZone tz = TimeZone.getTimeZone(zidStr);
124124
// no round-trip for alias and "GMT"
125125
if (!tz.equals(TimeZone.getTimeZone(tz.toZoneId()))
126-
&& !ZoneId.SHORT_IDS.containsKey(zidStr)
127126
&& !zidStr.startsWith("GMT")) {
128127
throw new RuntimeException("FAILED: tz -> zid -> tz :" + zidStr);
129128
}

‎test/jdk/java/util/Calendar/bug4316678.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2025, 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
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 4316678
26+
* @bug 4316678 8347841
2727
* @summary test that Calendar's Serialization works correctly.
2828
* @run junit bug4316678
2929
*/
@@ -53,7 +53,7 @@ public class bug4316678 {
5353
// Set custom JVM default TimeZone
5454
@BeforeAll
5555
static void initAll() {
56-
TimeZone.setDefault(TimeZone.getTimeZone("PST"));
56+
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
5757
}
5858

5959
// Restore JVM default Locale and TimeZone

‎test/jdk/java/util/Calendar/bug4372743.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2025, 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
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 4372743
26+
* @bug 4372743 8347841
2727
* @summary test that checks transitions of ERA and YEAR which are caused by add(MONTH).
2828
* @run junit bug4372743
2929
*/
@@ -67,7 +67,7 @@ public class bug4372743 {
6767
// Set custom JVM default timezone
6868
@BeforeAll
6969
static void initAll() {
70-
TimeZone.setDefault(TimeZone.getTimeZone("PST"));
70+
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
7171
}
7272

7373
// Restore JVM default timezone

‎test/jdk/java/util/Date/Bug4955000.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, 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
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 4955000
26+
* @bug 4955000 8347841
2727
* @summary Make sure that a Date and a GregorianCalendar produce the
2828
* same date/time. Both are new implementations in 1.5.
2929
*/
@@ -42,7 +42,7 @@ public class Bug4955000 {
4242
public static void main(String[] args) {
4343
TimeZone defaultTZ = TimeZone.getDefault();
4444
try {
45-
TimeZone.setDefault(TimeZone.getTimeZone("NST"));
45+
TimeZone.setDefault(TimeZone.getTimeZone("Pacific/Auckland"));
4646
GregorianCalendar gc = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
4747
// Date1025
4848
int[] years1 = {

‎test/jdk/java/util/Date/DateRegression.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2025, 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
@@ -23,7 +23,8 @@
2323

2424
/*
2525
* @test
26-
* @bug 4023247 4027685 4032037 4072029 4073003 4118010 4120606 4133833 4136916 6274757 6314387
26+
* @bug 4023247 4027685 4032037 4072029 4073003 4118010 4120606 4133833
27+
* 4136916 6274757 6314387 8347841
2728
* @run junit DateRegression
2829
*/
2930

@@ -106,7 +107,7 @@ public void Test4072029() {
106107
TimeZone saveZone = TimeZone.getDefault();
107108

108109
try {
109-
TimeZone.setDefault(TimeZone.getTimeZone("PST"));
110+
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
110111
Date now = new Date();
111112
String s = now.toString();
112113
Date now2 = new Date(now.toString());

‎test/jdk/java/util/Date/DateTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, 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
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 4143459
26+
* @bug 4143459 8347841
2727
* @summary test Date
2828
* @run junit DateTest
2929
*/
@@ -56,7 +56,7 @@ public void TestDefaultZoneLite() {
5656
d.setMonth(Calendar.JANUARY);
5757
d.setDate(1);
5858
d.setHours(6);
59-
TimeZone.setDefault(TimeZone.getTimeZone("PST"));
59+
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
6060
if (d.getHours() != 22) {
6161
fail("Fail: Date.setHours()/getHours() ignoring default zone");
6262
}
@@ -79,7 +79,7 @@ public void TestDefaultZone() {
7979
Date ref = new Date(883634400000L); // This is Thu Jan 1 1998 6:00 am GMT
8080
String refstr = "Jan 1 1998 6:00";
8181
TimeZone GMT = TimeZone.getTimeZone("GMT");
82-
TimeZone PST = TimeZone.getTimeZone("PST");
82+
TimeZone PST = TimeZone.getTimeZone("America/Los_Angeles");
8383

8484
String[] names = { "year", "month", "date", "day of week", "hour", "offset" };
8585
int[] GMT_EXP = { 98, Calendar.JANUARY, 1, Calendar.THURSDAY - Calendar.SUNDAY, 6, 0 };
@@ -207,7 +207,7 @@ public void TestDate480()
207207
{
208208
TimeZone save = TimeZone.getDefault();
209209
try {
210-
TimeZone.setDefault(TimeZone.getTimeZone("PST"));
210+
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
211211
Date d1=new java.util.Date(97,8,13,10,8,13);
212212
System.out.println("d = "+d1);
213213
Date d2=new java.util.Date(97,8,13,30,8,13); // 20 hours later

‎test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java

+10-32
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2007, 2025, 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
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 4052440 8003267 8062588 8210406 8174269 8327434
26+
* @bug 4052440 8003267 8062588 8210406 8174269 8327434 8347841
2727
* @summary TimeZoneNameProvider tests
2828
* @library providersrc/foobarutils
2929
* providersrc/barprovider
@@ -37,6 +37,7 @@
3737
import java.text.DateFormatSymbols;
3838
import java.text.ParseException;
3939
import java.text.SimpleDateFormat;
40+
import java.time.ZoneId;
4041
import java.time.format.TextStyle;
4142
import java.util.Arrays;
4243
import java.util.Calendar;
@@ -45,6 +46,7 @@
4546
import java.util.Locale;
4647
import java.util.MissingResourceException;
4748
import java.util.TimeZone;
49+
import java.util.function.Predicate;
4850
import java.util.stream.Stream;
4951

5052
import com.bar.TimeZoneNameProviderImpl;
@@ -72,7 +74,9 @@ public static void main(String[] s) {
7274
void test1() {
7375
List<Locale> jreimplloc = Arrays.asList(LocaleProviderAdapter.forType(LocaleProviderAdapter.Type.CLDR).getTimeZoneNameProvider().getAvailableLocales());
7476
List<Locale> providerLocales = Arrays.asList(tznp.getAvailableLocales());
75-
String[] ids = TimeZone.getAvailableIDs();
77+
String[] ids = Arrays.stream(TimeZone.getAvailableIDs())
78+
.filter(Predicate.not(ZoneId.SHORT_IDS::containsKey))
79+
.toArray(String[]::new);
7680

7781
// Sampling relevant locales
7882
Stream.concat(Stream.of(Locale.ROOT, Locale.US, Locale.JAPAN), providerLocales.stream()).forEach(target -> {
@@ -176,7 +180,7 @@ void test2() {
176180
df.parse(DISPLAY_NAMES_KYOTO[i]);
177181
}
178182
} catch (ParseException pe) {
179-
throw new RuntimeException("parse error occured" + pe);
183+
throw new RuntimeException("parse error occurred" + pe);
180184
} finally {
181185
// restore the reserved locale and time zone
182186
Locale.setDefault(defaultLocale);
@@ -186,8 +190,8 @@ void test2() {
186190

187191
void test3() {
188192
final String[] TZNAMES = {
189-
LATIME, PST, PST8PDT, US_PACIFIC,
190-
TOKYOTIME, JST, JAPAN,
193+
LATIME, PST8PDT, US_PACIFIC,
194+
TOKYOTIME, JAPAN,
191195
};
192196
for (String tzname : TZNAMES) {
193197
TimeZone tz = TimeZone.getTimeZone(tzname);
@@ -208,17 +212,13 @@ void test3() {
208212
}
209213

210214
final String LATIME = "America/Los_Angeles";
211-
final String PST = "PST";
212215
final String PST8PDT = "PST8PDT";
213216
final String US_PACIFIC = "US/Pacific";
214217
final String LATIME_IN_OSAKA =
215218
tznp.getDisplayName(LATIME, false, TimeZone.LONG, OSAKA);
216219

217220
final String TOKYOTIME = "Asia/Tokyo";
218-
final String JST = "JST";
219221
final String JAPAN = "Japan";
220-
final String JST_IN_OSAKA =
221-
tznp.getDisplayName(JST, false, TimeZone.LONG, OSAKA);
222222

223223
void aliasTest() {
224224
// Check that provider's name for a standard id (America/Los_Angeles) is
@@ -228,32 +228,10 @@ void aliasTest() {
228228
throw new RuntimeException("Could not get provider's localized name. result: "+latime+" expected: "+LATIME_IN_OSAKA);
229229
}
230230

231-
String pst = TimeZone.getTimeZone(PST).getDisplayName(OSAKA);
232-
if (!LATIME_IN_OSAKA.equals(pst)) {
233-
throw new RuntimeException("Provider's localized name is not available for an alias ID: "+PST+". result: "+pst+" expected: "+LATIME_IN_OSAKA);
234-
}
235-
236231
String us_pacific = TimeZone.getTimeZone(US_PACIFIC).getDisplayName(OSAKA);
237232
if (!LATIME_IN_OSAKA.equals(us_pacific)) {
238233
throw new RuntimeException("Provider's localized name is not available for an alias ID: "+US_PACIFIC+". result: "+us_pacific+" expected: "+LATIME_IN_OSAKA);
239234
}
240-
241-
// Check that provider's name for an alias id (JST) is
242-
// propagated to its standard id and alias ids.
243-
String jstime = TimeZone.getTimeZone(JST).getDisplayName(OSAKA);
244-
if (!JST_IN_OSAKA.equals(jstime)) {
245-
throw new RuntimeException("Could not get provider's localized name. result: "+jstime+" expected: "+JST_IN_OSAKA);
246-
}
247-
248-
String tokyotime = TimeZone.getTimeZone(TOKYOTIME).getDisplayName(OSAKA);
249-
if (!JST_IN_OSAKA.equals(tokyotime)) {
250-
throw new RuntimeException("Provider's localized name is not available for a standard ID: "+TOKYOTIME+". result: "+tokyotime+" expected: "+JST_IN_OSAKA);
251-
}
252-
253-
String japan = TimeZone.getTimeZone(JAPAN).getDisplayName(OSAKA);
254-
if (!JST_IN_OSAKA.equals(japan)) {
255-
throw new RuntimeException("Provider's localized name is not available for an alias ID: "+JAPAN+". result: "+japan+" expected: "+JST_IN_OSAKA);
256-
}
257235
}
258236

259237
/*

‎test/jdk/java/util/Properties/StoreDeadlock.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, 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
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 6199320
26+
* @bug 6199320 8347841
2727
* @summary Properties.store() causes deadlock when concurrently calling TimeZone apis
2828
* @run main/timeout=20 StoreDeadlock
2929
* @author Xueming Shen
@@ -59,7 +59,7 @@ public void run() {
5959
}
6060
class Thread2 extends Thread {
6161
public void run() {
62-
System.out.println("tz=" + TimeZone.getTimeZone("PST"));
62+
System.out.println("tz=" + TimeZone.getTimeZone("America/Los_Angeles"));
6363
}
6464
}
6565
}

‎test/jdk/java/util/TimeZone/Bug5097350.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2025, 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
@@ -23,16 +23,19 @@
2323

2424
/*
2525
* @test
26-
* @bug 5097350
26+
* @bug 5097350 8347841
2727
* @summary Make sure that TimeZone.getTimeZone returns a clone of a cached TimeZone instance.
2828
*/
2929

30+
import java.time.ZoneId;
3031
import java.util.*;
31-
import java.text.*;
32+
import java.util.function.Predicate;
3233

3334
public class Bug5097350 {
3435
public static void main(String[] args) {
35-
String[] tzids = TimeZone.getAvailableIDs();
36+
String[] tzids = Arrays.stream(TimeZone.getAvailableIDs())
37+
.filter(Predicate.not(ZoneId.SHORT_IDS::containsKey))
38+
.toArray(String[]::new);
3639
List<String> ids = new ArrayList<>(tzids.length + 10);
3740
ids.addAll(Arrays.asList(tzids));
3841
// add some custom ids

‎test/jdk/java/util/TimeZone/Bug6329116.java

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, 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
@@ -25,13 +25,15 @@
2525
* @test
2626
* @bug 6329116 6756569 6757131 6758988 6764308 6796489 6834474 6609737 6507067
2727
* 7039469 7090843 7103108 7103405 7158483 8008577 8059206 8064560 8072042
28-
* 8077685 8151876 8166875 8169191 8170316 8176044 8174269
28+
* 8077685 8151876 8166875 8169191 8170316 8176044 8174269 8347841
2929
* @summary Make sure that timezone short display names are identical to Olson's data.
3030
* @run junit Bug6329116
3131
*/
3232

3333
import java.io.*;
34+
import java.time.ZoneId;
3435
import java.util.*;
36+
import java.util.function.Predicate;
3537

3638
import org.junit.jupiter.api.Test;
3739

@@ -44,7 +46,9 @@ public class Bug6329116 {
4446

4547
// static Locale[] locales = Locale.getAvailableLocales();
4648
static Locale[] locales = {Locale.US};
47-
static String[] timezones = TimeZone.getAvailableIDs();
49+
static String[] timezones = Arrays.stream(TimeZone.getAvailableIDs())
50+
.filter(Predicate.not(ZoneId.SHORT_IDS::containsKey))
51+
.toArray(String[]::new);
4852

4953
@Test
5054
public void bug6329116() throws IOException {
@@ -101,6 +105,9 @@ public void bug6329116() throws IOException {
101105
tzs[0] = timezoneID;
102106

103107
for (int j = 0; j < tzs.length; j++) {
108+
if (ZoneId.SHORT_IDS.containsKey(tzs[j])) {
109+
continue;
110+
}
104111
tz = TimeZone.getTimeZone(tzs[j]);
105112

106113
if (!tzs[j].equals(tz.getID())) {

‎test/jdk/java/util/TimeZone/Bug6772689.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2025, 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
@@ -23,15 +23,18 @@
2323

2424
/*
2525
* @test
26-
* @bug 6772689
26+
* @bug 6772689 8347841
2727
* @summary Test for standard-to-daylight transitions at midnight:
2828
* date stays on the given day.
2929
*/
3030

31+
import java.time.ZoneId;
32+
import java.util.Arrays;
3133
import java.util.Calendar;
3234
import java.util.Date;
3335
import java.util.GregorianCalendar;
3436
import java.util.TimeZone;
37+
import java.util.function.Predicate;
3538
import static java.util.GregorianCalendar.*;
3639

3740
public class Bug6772689 {
@@ -43,7 +46,9 @@ public static void main(String[] args) {
4346
int errors = 0;
4447

4548
Calendar cal = new GregorianCalendar(BEGIN_YEAR, MARCH, 1);
46-
String[] tzids = TimeZone.getAvailableIDs();
49+
String[] tzids = Arrays.stream(TimeZone.getAvailableIDs())
50+
.filter(Predicate.not(ZoneId.SHORT_IDS::containsKey))
51+
.toArray(String[]::new);
4752
try {
4853
for (String id : tzids) {
4954
TimeZone tz = TimeZone.getTimeZone(id);

‎test/jdk/java/util/TimeZone/DaylightTimeTest.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2025, 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
@@ -23,17 +23,21 @@
2323

2424
/*
2525
* @test
26-
* @bug 6936350
26+
* @bug 6936350 8347841
2727
* @summary Test case for TimeZone.observesDaylightTime()
2828
*/
2929

30+
import java.time.ZoneId;
3031
import java.util.*;
32+
import java.util.function.Predicate;
3133
import static java.util.GregorianCalendar.*;
3234

3335
public class DaylightTimeTest {
3436
private static final int ONE_HOUR = 60 * 60 * 1000; // one hour
3537
private static final int INTERVAL = 24 * ONE_HOUR; // one day
36-
private static final String[] ZONES = TimeZone.getAvailableIDs();
38+
private static final String[] ZONES = Arrays.stream(TimeZone.getAvailableIDs())
39+
.filter(Predicate.not(ZoneId.SHORT_IDS::containsKey))
40+
.toArray(String[]::new);
3741
private static int errors = 0;
3842

3943
public static void main(String[] args) {

‎test/jdk/java/util/TimeZone/IDTest.java

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2025, 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
@@ -23,24 +23,30 @@
2323

2424
/*
2525
* @test
26-
* @bug 4509255 5055567 6176318 7090844
26+
* @bug 4509255 5055567 6176318 7090844 8347841
2727
* @summary Tests consistencies of time zone IDs.
2828
*/
2929

30+
import java.time.ZoneId;
3031
import java.util.Arrays;
3132
import java.util.HashSet;
3233
import java.util.Map;
3334
import java.util.Set;
3435
import java.util.TimeZone;
3536
import java.util.TreeMap;
37+
import java.util.function.Predicate;
3638

3739
public class IDTest {
3840
public static void main(String[] args) {
3941
Set<String> ids = new HashSet<>();
4042
Map<Integer, Set<String>> tree = new TreeMap<>();
4143

42-
String[] tzs = TimeZone.getAvailableIDs();
43-
String[] tzs2 = TimeZone.getAvailableIDs();
44+
String[] tzs = Arrays.stream(TimeZone.getAvailableIDs())
45+
.filter(Predicate.not(ZoneId.SHORT_IDS::containsKey))
46+
.toArray(String[]::new);
47+
String[] tzs2 = Arrays.stream(TimeZone.getAvailableIDs())
48+
.filter(Predicate.not(ZoneId.SHORT_IDS::containsKey))
49+
.toArray(String[]::new);
4450
if (tzs.length != tzs2.length) {
4551
throw new RuntimeException("tzs.length(" + tzs.length
4652
+ ") != tzs2.length(" + tzs2.length + ")");
@@ -83,8 +89,12 @@ public static void main(String[] args) {
8389
// Check the getAvailableIDs(int) call to return the same
8490
// set of IDs
8591
int offset = key.intValue();
86-
tzs = TimeZone.getAvailableIDs(offset);
87-
tzs2 = TimeZone.getAvailableIDs(offset);
92+
tzs = Arrays.stream(TimeZone.getAvailableIDs(offset))
93+
.filter(Predicate.not(ZoneId.SHORT_IDS::containsKey))
94+
.toArray(String[]::new);
95+
tzs2 = Arrays.stream(TimeZone.getAvailableIDs(offset))
96+
.filter(Predicate.not(ZoneId.SHORT_IDS::containsKey))
97+
.toArray(String[]::new);
8898
if (!Arrays.equals(tzs, tzs2)) {
8999
throw new RuntimeException("inconsistent tzs from getAvailableIDs("+offset+")");
90100
}

‎test/jdk/java/util/TimeZone/ListTimeZones.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2025, 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
@@ -23,17 +23,21 @@
2323

2424
/**
2525
* @test
26-
* @bug 6851214
26+
* @bug 6851214 8347841
2727
* @summary Allow 24:00 as a valid end/start DST time stamp
2828
* @run main ListTimeZones
2929
*/
3030

31+
import java.time.ZoneId;
3132
import java.util.*;
33+
import java.util.function.Predicate;
3234

3335
public class ListTimeZones{
3436
public static void main(String[] args){
3537
Date date = new Date();
36-
String TimeZoneIds[] = TimeZone.getAvailableIDs();
38+
String[] TimeZoneIds = Arrays.stream(TimeZone.getAvailableIDs())
39+
.filter(Predicate.not(ZoneId.SHORT_IDS::containsKey))
40+
.toArray(String[]::new);
3741
for(int i = 0; i < TimeZoneIds.length; i++){
3842
TimeZone tz = TimeZone.getTimeZone(TimeZoneIds[i]);
3943
Calendar calendar = new GregorianCalendar(tz);

‎test/jdk/java/util/TimeZone/TimeZoneBoundaryTest.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, 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
@@ -23,6 +23,7 @@
2323

2424
/*
2525
* @test
26+
* @bug 8347841
2627
* @summary test Time Zone Boundary
2728
* @run junit TimeZoneBoundaryTest
2829
*/
@@ -251,7 +252,7 @@ void verifyDST(Date d, TimeZone time_zone,
251252
@Test
252253
public void TestBoundaries()
253254
{
254-
TimeZone pst = TimeZone.getTimeZone("PST");
255+
TimeZone pst = TimeZone.getTimeZone("America/Los_Angeles");
255256
TimeZone save = TimeZone.getDefault();
256257
try {
257258
TimeZone.setDefault(pst);
@@ -410,11 +411,8 @@ else if (!z.useDaylightTime())
410411
@Test
411412
public void TestStepwise()
412413
{
413-
findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("ACT"), 0);
414-
// "EST" is disabled because its behavior depends on the mapping property. (6466476).
415-
//findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("EST"), 2);
416-
findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("HST"), 0);
417-
findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("PST"), 2);
414+
findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("Australia/Darwin"), 0);
415+
findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("Pacific/Honolulu"), 0);
418416
findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("PST8PDT"), 2);
419417
findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("SystemV/PST"), 0);
420418
findBoundariesStepwise(1997, ONE_DAY, TimeZone.getTimeZone("SystemV/PST8PDT"), 2);

‎test/jdk/java/util/TimeZone/TimeZoneRegression.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2025, 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
@@ -25,7 +25,7 @@
2525
* @test
2626
* @bug 4052967 4073209 4073215 4084933 4096952 4109314 4126678 4151406 4151429
2727
* 4154525 4154537 4154542 4154650 4159922 4162593 4173604 4176686 4184229 4208960
28-
* 4966229 6433179 6851214 8007520 8008577 8174269
28+
* 4966229 6433179 6851214 8007520 8008577 8174269 8347841
2929
* @library /java/text/testlib
3030
* @run junit TimeZoneRegression
3131
*/
@@ -42,8 +42,8 @@ public class TimeZoneRegression {
4242

4343
@Test
4444
public void Test4073209() {
45-
TimeZone z1 = TimeZone.getTimeZone("PST");
46-
TimeZone z2 = TimeZone.getTimeZone("PST");
45+
TimeZone z1 = TimeZone.getTimeZone("America/Los_Angeles");
46+
TimeZone z2 = TimeZone.getTimeZone("America/Los_Angeles");
4747
if (z1 == z2) {
4848
fail("Fail: TimeZone should return clones");
4949
}
@@ -81,7 +81,7 @@ public void Test4084933() {
8181
// test both SimpleTimeZone and ZoneInfo objects.
8282
// @since 1.4
8383
sub4084933(getPST());
84-
sub4084933(TimeZone.getTimeZone("PST"));
84+
sub4084933(TimeZone.getTimeZone("America/Los_Angeles"));
8585
}
8686

8787
private void sub4084933(TimeZone tz) {
@@ -122,7 +122,7 @@ private void sub4084933(TimeZone tz) {
122122

123123
@Test
124124
public void Test4096952() {
125-
String[] ZONES = { "GMT", "MET", "IST" };
125+
String[] ZONES = { "GMT", "MET", "Asia/Kolkata" };
126126
boolean pass = true;
127127
try {
128128
for (int i=0; i<ZONES.length; ++i) {
@@ -172,7 +172,7 @@ public void Test4109314() {
172172
// test both SimpleTimeZone and ZoneInfo objects.
173173
// @since 1.4
174174
sub4109314(getPST());
175-
sub4109314(TimeZone.getTimeZone("PST"));
175+
sub4109314(TimeZone.getTimeZone("America/Los_Angeles"));
176176
}
177177

178178

@@ -303,7 +303,7 @@ public void Test4126678() {
303303
// test both SimpleTimeZone and ZoneInfo objects.
304304
// @since 1.4
305305
sub4126678(getPST());
306-
sub4126678(TimeZone.getTimeZone("PST"));
306+
sub4126678(TimeZone.getTimeZone("America/Los_Angeles"));
307307

308308
// restore the initial time zone so that this test case
309309
// doesn't affect the others.
@@ -755,7 +755,7 @@ public void Test4173604() {
755755
// test both SimpleTimeZone and ZoneInfo objects.
756756
// @since 1.4
757757
sub4173604(getPST());
758-
sub4173604(TimeZone.getTimeZone("PST"));
758+
sub4173604(TimeZone.getTimeZone("America/Los_Angeles"));
759759
}
760760

761761
private void sub4173604(TimeZone pst) {
@@ -915,7 +915,7 @@ public void Test4208960 () {
915915
// test both SimpleTimeZone and ZoneInfo objects.
916916
// @since 1.4
917917
sub4208960(getPST());
918-
sub4208960(TimeZone.getTimeZone("PST"));
918+
sub4208960(TimeZone.getTimeZone("America/Los_Angeles"));
919919
}
920920

921921
private void sub4208960(TimeZone tz) {

‎test/jdk/java/util/TimeZone/bug4096952.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2025, 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
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 4096952
26+
* @bug 4096952 8347841
2727
* @summary simple serialization/deserialization test
2828
*/
2929

@@ -38,7 +38,7 @@ public class bug4096952 {
3838

3939
public static void main(String[] args) {
4040
int errors = 0;
41-
String[] ZONES = { "GMT", "MET", "IST" };
41+
String[] ZONES = { "GMT", "MET", "Asia/Kolkata" };
4242
for (String id : ZONES) {
4343
TimeZone zone = TimeZone.getTimeZone(id);
4444
try {

‎test/jdk/sun/security/x509/X509CertImpl/V3Certificate.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2025, 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
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 8049237 8242151
26+
* @bug 8049237 8242151 8347841
2727
* @modules java.base/sun.security.x509
2828
* java.base/sun.security.util
2929
* jdk.crypto.ec
@@ -114,7 +114,7 @@ public static boolean test(String algorithm, String sigAlg, int keyLength)
114114

115115
// Validity interval
116116
Date firstDate = new Date();
117-
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("PST"));
117+
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("America/Los_Angeles"));
118118
cal.set(2014, 03, 10, 12, 30, 30);
119119
Date lastDate = cal.getTime();
120120
CertificateValidity interval = new CertificateValidity(firstDate,

‎test/jdk/sun/util/resources/TimeZone/Bug4640234.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2007, 2025, 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
@@ -23,7 +23,7 @@
2323

2424
/**
2525
* @test
26-
* @bug 4640234 4946057 4938151 4873691 5023181
26+
* @bug 4640234 4946057 4938151 4873691 5023181 8347841
2727
* @summary Verifies the translation of time zone names, this test will catch
2828
* presence of country name for english and selected locales for all
2929
* ISO country codes.
@@ -42,13 +42,16 @@
4242
import java.text.MessageFormat;
4343
import java.text.SimpleDateFormat;
4444

45+
import java.time.ZoneId;
46+
import java.util.Arrays;
4547
import java.util.Date;
4648
import java.util.Locale;
4749
import java.util.Enumeration;
4850
import java.util.HashMap;
4951
import java.util.Map;
5052
import java.util.ResourceBundle;
5153
import java.util.TimeZone;
54+
import java.util.function.Predicate;
5255

5356
import sun.util.resources.LocaleData;
5457

@@ -83,7 +86,9 @@ public static void main(String[] args) throws Exception {
8386
StringBuffer errors = new StringBuffer("");
8487
StringBuffer warnings = new StringBuffer("");
8588

86-
String[] timezones = TimeZone.getAvailableIDs();
89+
String[] timezones = Arrays.stream(TimeZone.getAvailableIDs())
90+
.filter(Predicate.not(ZoneId.SHORT_IDS::containsKey))
91+
.toArray(String[]::new);
8792
String[] countries = locEn.getISOCountries();
8893
String[] languages = locEn.getISOLanguages();
8994

‎test/jdk/sun/util/resources/cldr/Bug8134384.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2025, 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
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 8134384 8234347 8236548
26+
* @bug 8134384 8234347 8236548 8347841
2727
* @summary Tests CLDR TimeZoneNames has English names for all tzids
2828
* @run main/othervm -Djava.locale.providers=CLDR Bug8134384
2929
*/
@@ -38,6 +38,9 @@ public static void main(String [] args) {
3838

3939
try {
4040
for (String tz : TimeZone.getAvailableIDs() ) {
41+
if (ZoneId.SHORT_IDS.containsKey(tz)) {
42+
continue;
43+
}
4144
TimeZone.setDefault(TimeZone.getTimeZone(tz));
4245
// Summer solstice
4346
String date1 = Date.from(Instant.parse("2015-06-21T00:00:00.00Z")).toString();

‎test/jdk/sun/util/resources/cldr/Bug8202764.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, 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
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 8202764
26+
* @bug 8202764 8347841
2727
* @modules jdk.localedata
2828
* @summary Checks time zone names are consistent with aliased ids,
2929
* between DateFormatSymbols.getZoneStrings() and getDisplayName()
@@ -49,6 +49,7 @@ public class Bug8202764 {
4949
public void testAliasedTZs() {
5050
Set<String> zoneIds = ZoneId.getAvailableZoneIds();
5151
Arrays.stream(DateFormatSymbols.getInstance(Locale.US).getZoneStrings())
52+
.filter(zone -> !ZoneId.SHORT_IDS.containsKey(zone[0]))
5253
.forEach(zone -> {
5354
System.out.println(zone[0]);
5455
TimeZone tz = TimeZone.getTimeZone(zone[0]);

0 commit comments

Comments
 (0)
Please sign in to comment.