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

Timezone "Canada/East-Saskatchewan" not found in java.util.TimeZone.getAvailableIDs()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 8u161
    • core-libs

      FULL PRODUCT VERSION :
      root@cncd-av-vm-229-118:~/#: which java
      /usr/bin/java

      root@cncd-av-vm-229-118:~/#: java -version
      java version "1.8.0_161"
      Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
      Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      root@cncd-av-vm-229-118:~/#: cat /etc/issue.net
      Welcome to SUSE Linux Enterprise Server 11 SP4 (x86_64) - Kernel %r (%t).

      root@cncd-av-vm-229-118:~/#: uname -a
      Linux cncd-av-vm-229-118.ccoe.lab.emc.com 3.0.101-108.13-default #1 SMP Wed Oct 11 12:30:40 UTC 2017 (294ccfe) x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      Regression test failed due to timezone "Canada/East-Saskatchewan" not list as expected since upgrading original java version from "1.8.0_144" to "1.8.0_161".

      RCA the issue, and I found that all expected timezones are listed by directly invoking the method in java.util.TimeZone.getAvailableIDs().

      Then I wrote a test, running it in above 2 versions respectively, the former works fine as expected, the later doesn't work.

      BTW, not sure if it works fine in 1.8.0_151.




      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      public class TimezoneGetAvailableIDsTest {

          static String[] expectedTimeZones = new String[] {"Canada/East-Saskatchewan"}; // default

          public static void main(String[] args) {

              if (args.length > 0) {
                  expectedTimeZones = args;
              }

              List<String> availableIDs = Arrays.asList(TimeZone.getAvailableIDs());
              System.out.println("Available timezone list: \n" + availableIDs);
              for (String expectedTimeZone : expectedTimeZones) {
                  if (availableIDs.contains(expectedTimeZone)) {
                      System.out.println("Found expected timezone: " + expectedTimeZone);
                  }
              }
          }
      }

      >java -jar TimezoneGetAvailableIDsTest.jar

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Should have been with the following log output:

      >Found expected timezone: Canada/East-Saskatchewan
      ACTUAL -
      Without above expected log output.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package com.dellemc;

      import java.util.Arrays;
      import java.util.List;
      import java.util.TimeZone;

      public class TimezoneGetAvailableIDsTest {

          static String[] expectedTimeZones = new String[] {"Canada/East-Saskatchewan"}; // default

          public static void main(String[] args) {

              if (args.length > 0) {
                  expectedTimeZones = args;
              }

              List<String> availableIDs = Arrays.asList(TimeZone.getAvailableIDs());
              System.out.println("Available timezone list: \n" + availableIDs);
              for (String expectedTimeZone : expectedTimeZones) {
                  if (availableIDs.contains(expectedTimeZone)) {
                      System.out.println("Found expected timezone: " + expectedTimeZone);
                  }
              }
          }

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      N/A, except manually append lost timezone

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

              Created:
              Updated:
              Resolved: