PDA

View Full Version : java.sql.Date/Timestamp/Time fields choke on null


dirichs
01-05-2012, 09:49 AM
Hello,
using Hessian 4.0.7, I just noticed that fields of type java.sql.Date, java.sql.Timestamp and java.sql.Time are handled specially during Deserialization. However, the implementation does not handle null values gracefully:

com.caucho.hessian.client.HessianRuntimeException: com.caucho.hessian.io.HessianFieldException: dynaserv.domain.Route.lastModifield: java.sql.Timestamp cannot be assigned from null
at com.caucho.hessian.client.HessianProxy.invoke(Hess ianProxy.java:221)
at $Proxy3.route(Unknown Source)
at dynaclient.actions.StartRouting.run(StartRouting.j ava:53)
at org.eclipse.jface.action.Action.runWithEvent(Actio n.java:498)
at org.eclipse.jface.action.ActionContributionItem.ha ndleWidgetSelection(ActionContributionItem.java:58 4)
at org.eclipse.jface.action.ActionContributionItem.ac cess$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$6. handleEvent(ActionContributionItem.java:452)
at org.eclipse.swt.widgets.EventTable.sendEvent(Event Table.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.ja va:1258)
at org.eclipse.swt.widgets.Display.runDeferredEvents( Display.java:3540)
at org.eclipse.swt.widgets.Display.readAndDispatch(Di splay.java:3161)
at org.eclipse.ui.internal.Workbench.runEventLoop(Wor kbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench. java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workben ch.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench. java:671)
at org.eclipse.core.databinding.observable.Realm.runW ithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWork bench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(Pl atformUI.java:149)
at dynaclient.Application.start(Application.java:24)
at org.eclipse.equinox.internal.app.EclipseAppHandle. run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseA ppLauncher.runApplication(EclipseAppLauncher.java: 110)
at org.eclipse.core.runtime.internal.adaptor.EclipseA ppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.ru n(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.ru n(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework( Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.ja va:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:14 07)
at org.eclipse.equinox.launcher.Main.main(Main.java:1 383)
Caused by: com.caucho.hessian.io.HessianFieldException: dynaserv.domain.Route.lastModifield: java.sql.Timestamp cannot be assigned from null
at com.caucho.hessian.io.UnsafeDeserializer.logDeseri alizeError(UnsafeDeserializer.java:774)
at com.caucho.hessian.io.UnsafeDeserializer$SqlTimest ampFieldDeserializer.deserialize(UnsafeDeserialize r.java:725)
at com.caucho.hessian.io.UnsafeDeserializer.readObjec t(UnsafeDeserializer.java:239)
at com.caucho.hessian.io.UnsafeDeserializer.readObjec t(UnsafeDeserializer.java:150)
at com.caucho.hessian.io.Hessian2Input.readObjectInst ance(Hessian2Input.java:2188)
at com.caucho.hessian.io.Hessian2Input.readObject(Hes sian2Input.java:1695)
at com.caucho.hessian.io.Hessian2Input.readObject(Hes sian2Input.java:1679)
at com.caucho.hessian.io.UnsafeDeserializer$ObjectFie ldDeserializer.deserialize(UnsafeDeserializer.java :417)
at com.caucho.hessian.io.UnsafeDeserializer.readObjec t(UnsafeDeserializer.java:239)
at com.caucho.hessian.io.UnsafeDeserializer.readObjec t(UnsafeDeserializer.java:150)
at com.caucho.hessian.io.Hessian2Input.readObjectInst ance(Hessian2Input.java:2188)
at com.caucho.hessian.io.Hessian2Input.readObject(Hes sian2Input.java:1695)
at com.caucho.hessian.io.Hessian2Input.readObject(Hes sian2Input.java:1679)
at com.caucho.hessian.io.Hessian2Input.readReply(Hess ian2Input.java:346)
at com.caucho.hessian.client.HessianProxy.invoke(Hess ianProxy.java:194)
... 31 more
Caused by: java.lang.NullPointerException
at com.caucho.hessian.io.UnsafeDeserializer$SqlTimest ampFieldDeserializer.deserialize(UnsafeDeserialize r.java:721)
... 44 more

I suspect that this in an error of the Deserialization implementation of these fields. Or is there a deeper reason to not allow null values in these fields?

ssinha
10-07-2012, 03:52 PM
Hey, Even I am facing this issue when I am trying to deserialize my object containing a Timestamp field which is null while using Hessian 4.0.7. It fails. I have to choose a solution for serializing and deserializing my java objects for my live product. Can the admin from Hessian tell me as when they are going to fix this issue which has been here for quite long I suppose. Its URGENT !! Anticipating for your reply...Thanks.. @SS