You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having trouble deserializing to a bean that contains an Option[Int]. It seems that when the JodaModule is registered, the deserialization puts a Some[JodaPeriod] in as the value of the Option[Int] (!) which then causes a ClassCastException when I try to access it.
The following exception is thrown by the mapper2.readValue call in the sample code.
Exception in thread "main" java.lang.ClassCastException: org.joda.time.Period cannot be cast to java.lang.Integer
at scala.runtime.BoxesRunTime.unboxToInt(Unknown Source)
at JodaTimeTest$.main(JodaTimeTest.scala:15)
at JodaTimeTest.main(JodaTimeTest.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
I added a test to try to reproduce this issue, but I'm not able to in my environment. Your file above compiles and runs fine for me, using scala 2.9.1.final on Java 1.6 on MacOS. Can you be more specific about your environment, that might indicate why this is failing for you?
I'm having trouble deserializing to a bean that contains an
Option[Int]
. It seems that when the JodaModule is registered, the deserialization puts aSome[JodaPeriod]
in as the value of theOption[Int]
(!) which then causes aClassCastException
when I try to access it.The following exception is thrown by the
mapper2.readValue
call in the sample code.The text was updated successfully, but these errors were encountered: