Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8214210

Incorrect time pasring by ZonedDateTime.parse method for "Europe/Minsk" TZ

XMLWordPrintable

    • x86_64
    • linux_ubuntu

      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


            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: