I am upgrading the JRE version from 1.3 to 1.5 and in the process of that I witness ClassCastException being thrwon by the following statement(statement 3)
I am trying to assign the proper gmtoffset based on the current local timezone. Some research on our end suggests that such casting is not supported in higher version of jre.
Could any one please suggest a workaround for this?
Thanks, Himadri
bart zagers
Ranch Hand
Joined: Feb 05, 2003
Posts: 234
posted
0
You don't have to get the timeZone of the GregorianCalendar. Just create your own and pass that to the calendar.
Originally posted by Himadri Joshi: Some research on our end suggests that such casting is not supported in higher version of jre.
That's because in Java 5, Calendar.getTimeZone() does not return a SimpleTimeZone object. Note that the API documentation just says that it returns a TimeZone. Which subclass of class TimeZone it actually returns is not specified, so you should not rely on it being a SimpleTimeZone.