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

Formatter/BasicDateTime test behaviour needs to be reverted and issue fixed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 7u291, 8u281, 11.0.10-oracle, 15.0.2, 16
    • core-libs

      After tzdata2020b, Formatter/Basic.java reports

      FAILED: '%tZ': Expected 'PST', got 'MST'
      FAILED: '%tZ': Expected 'PST', got 'MST'
      FAILED: '%tZ': Expected 'PST', got 'MST'
      FAILED: '%TZ': Expected 'PST', got 'MST'
      FAILED: '%TZ': Expected 'PST', got 'MST'
      FAILED: '%TZ': Expected 'PST', got 'MST'
      FAILED: '%tc': Expected 'Tue May 23 19:48:34 PST 1995', got 'Tue May 23 19:48:34 MST 1995'
      FAILED: '%tc': Expected 'Tue May 23 19:48:34 PST 1995', got 'Tue May 23 19:48:34 MST 1995'
      FAILED: '%tc': Expected 'Tue May 23 19:48:34 PST 1995', got 'Tue May 23 19:48:34 MST 1995'
      FAILED: '%Tc': Expected 'TUE MAY 23 19:48:34 PST 1995', got 'TUE MAY 23 19:48:34 MST 1995'
      FAILED: '%Tc': Expected 'TUE MAY 23 19:48:34 PST 1995', got 'TUE MAY 23 19:48:34 MST 1995'
      FAILED: '%Tc': Expected 'TUE MAY 23 19:48:34 PST 1995', got 'TUE MAY 23 19:48:34 MST 1995'
      Exception in thread "main" java.lang.RuntimeException: 6313 tests: 12 failure(s), first
      at Basic.main(Basic.java:100)
      Caused by: java.lang.RuntimeException: '%tZ': Expected 'PST', got 'MST'
      at Basic.setFirst(Basic.java:64)
      at Basic.fail(Basic.java:57)
      at Basic.ck(Basic.java:72)
      at BasicDateTime.test(BasicDateTime.java:54)
      at BasicDateTime.testDateTime(BasicDateTime.java:150)
      at BasicDateTime.testDateTime(BasicDateTime.java:141)
      at BasicDateTime.test(BasicDateTime.java:1658)
      at Basic.main(Basic.java:97)

      for timezones - "America/Dawson", "America/WhiteHorse" and "Canada/Yukon".

      Currently, a placeholder has been put in place so no failure is seen. But it should be investigated and fixed as the above-mentioned timezones move to MST only on 1 Nov 2020.


      Here is a simple test case :

      import java.util.*;
      import java.lang.*;

      public class Basic {
          public static void main(String args[]) {
              SimpleTimeZone tz = new SimpleTimeZone(-8 * 60 * 60 * 1000, "America/Dawson");
              Calendar cl = new GregorianCalendar(tz, Locale.US);
              cl.set(2020,10,16, 19, 48, 34);
              cl.set(Calendar.MILLISECOND, 584);
              Formatter f = new Formatter(new StringBuilder(), Locale.US);
              f.format("%tZ", cl);
              System.out.println("Short name = " + f.toString());
          }
      }

            kravikumar Kiran Sidhartha Ravikumar (Inactive)
            kravikumar Kiran Sidhartha Ravikumar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: