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

ClassCastException when casting from TimeZone to SimpleTimeZone

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.4.0
    • core-libs
    • generic, x86, sparc
    • generic, solaris_8, windows_nt

      While attempting to verify bug: 4300378, I came across the following exception. It starts at Merlin-beta b45.

      ----------------------------------------------------------
      Exception in thread "main" java.lang.ClassCastException: sun.util.calendar.ZoneInfo
              at GetDSTSavingsTest.<init>(GetDSTSavingsTest.java:8)
              at GetDSTSavingsTest.main(GetDSTSavingsTest.java:17)
      ----------------------------------------------------------

      The following program reproduces it:

      ----------------------------------------------------------
      import java.util.*;

      public class GetDSTSavingsTest {

          SimpleTimeZone stz;

          public GetDSTSavingsTest() {
              stz = (SimpleTimeZone)TimeZone.getTimeZone("Asia/Tokyo");

              System.out.println("Observes daylight savings time? " +
                                 stz.useDaylightTime());
              System.out.println("Daylight savings time value(should be 0 if not " +
                                 "observed): " + stz.getDSTSavings());
          }

          public static void main(String[] args) {
              new GetDSTSavingsTest();
          }
      }
      ----------------------------------------------------------


      edmund.lou@eng 2001-01-02
      ===================================

            okutsu Masayoshi Okutsu
            elousunw Edmund Lou (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: