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

ClassCastException when casting from TimeZone to SimpleTimeZone

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic, x86, sparc
    • OS:
      generic, solaris_8, windows_nt

      Description

      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
      ===================================

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: