JDK-8214210 : Incorrect time pasring by ZonedDateTime.parse method for "Europe/Minsk" TZ
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.time
  • Affected Version: 11
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: linux_ubuntu
  • CPU: x86_64
  • Submitted: 2018-11-15
  • Updated: 2018-12-03
  • Resolved: 2018-11-22
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Ubuntu 16.04 64 Linux,

openjdk version "11" 2018-09-25
OpenJDK Runtime Environment (build 11+24-Ubuntu-116.04.1)
OpenJDK 64-Bit Server VM (build 11+24-Ubuntu-116.04.1, mixed mode, sharing)

Additional groovy script provided for testing  (Groovy 2.5.4), the same result we have for Junit (4.2) test


A DESCRIPTION OF THE PROBLEM :
Try to parse some string values and check results using toString method for Europe/Minsk time zone.

Set default time zone: TimeZone.setDefault(TimeZone.getTimeZone("Europe/Minsk"));

For example, apply ZonedDateTime.parse for each next values:

"2007-12-03T10:15:30+01:00[Europe/Minsk]",
"2007-07-03T10:15:30+01:00[Europe/Minsk]",
"2018-12-03T10:15:30+01:00[Europe/Minsk]",
"2018-07-03T10:15:30+01:00[Europe/Minsk]",

we will have results of zonedDateTime.toString() :

2007-12-03T11:15:30+02:00[Europe/Minsk]
2007-07-03T12:15:30+03:00[Europe/Minsk]
2018-12-03T12:15:30+03:00[Europe/Minsk]
2018-07-03T12:15:30+03:00[Europe/Minsk]



REGRESSION : Last worked in version 11

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to run provided  groovy script.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Is 2007-12-03T10:15:30+01:00[Europe/Minsk] equal 2007-12-03T10:15:30+01:00[Europe/Minsk] : true
 *** 

 Is 2007-07-03T10:15:30+01:00[Europe/Minsk] equal 2007-07-03T10:15:30+01:00[Europe/Minsk] : true
 *** 

 Is 2018-12-03T10:15:30+01:00[Europe/Minsk] equal 2018-12-03T10:15:30+01:00[Europe/Minsk] : true
 *** 

 Is 2018-07-03T10:15:30+01:00[Europe/Minsk] equal 2018-07-03T10:15:30+01:00[Europe/Minsk] : true
ACTUAL -
Is 2007-12-03T11:15:30+02:00[Europe/Minsk] equal 2007-12-03T10:15:30+01:00[Europe/Minsk] : false
 *** 

 Is 2007-07-03T12:15:30+03:00[Europe/Minsk] equal 2007-07-03T10:15:30+01:00[Europe/Minsk] : false
 *** 

 Is 2018-12-03T12:15:30+03:00[Europe/Minsk] equal 2018-12-03T10:15:30+01:00[Europe/Minsk] : false
 *** 

 Is 2018-07-03T12:15:30+03:00[Europe/Minsk] equal 2018-07-03T10:15:30+01:00[Europe/Minsk] : false

---------- BEGIN SOURCE ----------

import java.time.ZonedDateTime;
import java.util.TimeZone;

TimeZone.setDefault(TimeZone.getTimeZone("Europe/Minsk"));
def String minskTimeA = "2007-12-03T10:15:30+01:00[Europe/Minsk]"
def String minskTimeB = "2007-07-03T10:15:30+01:00[Europe/Minsk]"
def String minskTimeC = "2018-12-03T10:15:30+01:00[Europe/Minsk]"
def String minskTimeD = "2018-07-03T10:15:30+01:00[Europe/Minsk]"

ZonedDateTime zonedDateTime = ZonedDateTime.parse(minskTimeA);
print "\n Is " + zonedDateTime.toString() + " equal " + minskTimeA + " : "
print zonedDateTime.toString() == minskTimeA

print "\n *** \n"

zonedDateTime = ZonedDateTime.parse(minskTimeB);
print "\n Is " + zonedDateTime.toString() + " equal " + minskTimeB + " : "
print zonedDateTime.toString() == minskTimeB

print "\n *** \n"

zonedDateTime = ZonedDateTime.parse(minskTimeC);
print "\n Is " + zonedDateTime.toString() + " equal " + minskTimeC + " : "
print zonedDateTime.toString() == minskTimeC

print "\n *** \n"

zonedDateTime = ZonedDateTime.parse(minskTimeD);
print "\n Is " + zonedDateTime.toString() + " equal " + minskTimeD + " : "
print zonedDateTime.toString() == minskTimeD


---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Try to use Europe/Moskow timezone

FREQUENCY : always



Comments
With the fix for JDK-8066982 , ZonedDateTime.parse() now gives priority to Offset over Zone. For example in : 2007-12-03T10:15:30+01:00[Europe/Minsk] , because the offset takes priority , it is parsed in +01:00 timezone and then converted to Europe/Minsk Timezone. In the output the time has been converted to corresponding Europe/Minsk local time and offset.
22-11-2018