Details
-
Bug
-
Resolution: Fixed
-
P3
-
21
-
b04
-
linux
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8301976 | 20.0.2 | Ichiroh Takiguchi | P3 | Resolved | Fixed | b01 |
JDK-8301815 | 20.0.1 | Ichiroh Takiguchi | P3 | Resolved | Fixed | b05 |
JDK-8313288 | 17.0.10-oracle | Johny Jose | P3 | Resolved | Fixed | b04 |
JDK-8301816 | 17.0.7 | Ichiroh Takiguchi | P3 | Resolved | Fixed | b01 |
JDK-8301817 | 11.0.19 | Ichiroh Takiguchi | P3 | Resolved | Fixed | b01 |
Description
I created small testcase (CheckDST.java) from CustomTzIDCheckDST.java
$ cat CheckDST.java
import java.util.Calendar;
import java.util.Date;
import java.util.SimpleTimeZone;
public class CheckDST {
private static String CUSTOM_TZ = "MEZ-1MESZ,M3.5.0,M10.5.0";
public static void main(String args[]) throws Throwable {
runTZTest();
}
/* TZ code will always be set to "MEZ-1MESZ,M3.5.0,M10.5.0".
* This ensures the transition periods for Daylights Savings should be at March's last
* Sunday and October's last Sunday.
*/
private static void runTZTest() {
Date time = new Date();
if (new SimpleTimeZone(3600000, "MEZ-1MESZ", Calendar.MARCH, -1, Calendar.SUNDAY, 0,
Calendar.OCTOBER, -1, Calendar.SUNDAY, 0).inDaylightTime(time)) {
// We are in Daylight savings period.
if (time.toString().endsWith("GMT+02:00 " + Integer.toString(time.getYear() + 1900)))
return;
} else {
if (time.toString().endsWith("GMT+01:00 " + Integer.toString(time.getYear() + 1900)))
return;
}
// Reaching here means time zone did not match up as expected.
throw new RuntimeException("Got unexpected timezone information: " + time);
}
}
I tested CheckDST with faketime, then I got following results
$ TZ=GMT faketime -m "2023-03-25 22:59:59" env TZ="MEZ-1MESZ,M3.5.0,M10.5.0" $HOME/jdk-21-b02/bin/java CheckDST
$ TZ=GMT faketime -m "2023-03-25 23:00:00" env TZ="MEZ-1MESZ,M3.5.0,M10.5.0" $HOME/jdk-21-b02/bin/java CheckDST
Exception in thread "main" java.lang.RuntimeException: Got unexpected timezone information: Sun Mar 26 00:00:00 GMT+01:00 2023
at CheckDST.runTZTest(CheckDST.java:28)
at CheckDST.main(CheckDST.java:8)
Attachments
Issue Links
- backported by
-
JDK-8301815 CustomTzIDCheckDST.java may fail at future date
- Resolved
-
JDK-8301816 CustomTzIDCheckDST.java may fail at future date
- Resolved
-
JDK-8301817 CustomTzIDCheckDST.java may fail at future date
- Resolved
-
JDK-8301976 CustomTzIDCheckDST.java may fail at future date
- Resolved
-
JDK-8313288 CustomTzIDCheckDST.java may fail at future date
- Resolved
- links to
-
Commit openjdk/jdk11u-dev/f5a04fbc
-
Commit openjdk/jdk17u-dev/0ed36894
-
Commit openjdk/jdk20u/d431a7c7
-
Commit openjdk/jdk/5e2de896
-
Review openjdk/jdk11u-dev/1703
-
Review openjdk/jdk17u-dev/1140
-
Review openjdk/jdk20u/3
-
Review openjdk/jdk/11756