-
Bug
-
Resolution: Fixed
-
P3
-
8u20
-
b100
-
x86_64
-
windows_7
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8149540 | 8-pool | Ramanand Patil | P3 | Open | Unresolved |
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
Parsing a string with ZonedDateTime.parse() that contains zone offset and zone ID "Europe/Berlin" returns a wrong ZonedDateAndTime (different offset). This error starts exactly at the transition time (included) and ends one hour later (excluded).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create a ZonedDateTime with date/time of the DST transition in fall and a ZoneId different from UTC (e.g. "Europe/Berlin")
2. apply ZonedDateTime.format() with ISO_ZONED_DATE_TIME formatter
3. apply ZonedDateTime.parse() to the formatted string with same formatter
4. compare the result to the starting value
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The parsed string should represent the same instant on the time line.
ACTUAL -
Starting at the fall DST transition time (included) and ending one hour later (excluded) the offset is one hour too high. Lies 2..5 show wrong result, 1st and last line are correct.
2012-10-28T02:45:00+02:00[Europe/Berlin] -> 2012-10-28T02:45+02:00[Europe/Berlin]
2012-10-28T02:00:00+01:00[Europe/Berlin] -> 2012-10-28T02:00+02:00[Europe/Berlin]
2012-10-28T02:15:00+01:00[Europe/Berlin] -> 2012-10-28T02:15+02:00[Europe/Berlin]
2012-10-28T02:30:00+01:00[Europe/Berlin] -> 2012-10-28T02:30+02:00[Europe/Berlin]
2012-10-28T02:45:00+01:00[Europe/Berlin] -> 2012-10-28T02:45+02:00[Europe/Berlin]
2012-10-28T03:00:00+01:00[Europe/Berlin] -> 2012-10-28T03:00+01:00[Europe/Berlin]
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
public class LocalDateTimeIssue {
public static void main(String[] args) {
ZonedDateTime zdt = ZonedDateTime.of(2012, 10, 28, 2, 45, 0, 0, ZoneId.of("Europe/Berlin"));
DateTimeFormatter fmt = DateTimeFormatter.ISO_ZONED_DATE_TIME;
for (int i = 0; i < 6; i++) {
String s = zdt.format(fmt);
System.out.println(s + " -> " + ZonedDateTime.parse(s, fmt));
zdt = zdt.plus(15, ChronoUnit.MINUTES);
}
}
}
---------- END SOURCE ----------
- backported by
-
JDK-8149540 ZonedDateTime.parse() returns wrong ZoneOffset around DST fall transition
-
- Open
-
- duplicates
-
JDK-8183553 Incorrect ZonedDateTime parsing from String on Daylight saving
-
- Closed
-
- relates to
-
JDK-8214210 Incorrect time pasring by ZonedDateTime.parse method for "Europe/Minsk" TZ
-
- Closed
-
-
JDK-8183913 Regression: DateTimeFormatter.parse(String) miscalculates ChronoField.INSTANT_SECONDS
-
- Closed
-
-
JDK-8211337 ZonedDateTime.parse() not correctly handling MST zone (U.Mountain Standard Time)
-
- Closed
-
-
JDK-8136740 ZonedDateTime - parsing an date time string on a daylight saving boundary
-
- Closed
-