• Post Reply Bookmark Topic Watch Topic
  • New Topic

ClassCastException - SimpleTimeZone  RSS feed

 
H. J. Yoshi
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't have to get the timeZone of the GregorianCalendar.
Just create your own and pass that to the calendar.

 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16028
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!