Using smartgwt3.0p nightly build, starting around 10/25 of this year, the ListGrid method getAttributeAsDate() is no longer returning a serializable java.util.Date object. This is breaking all our objects being serialized back to the server. Is there a reason why this was added? Is there an alternative method that will be added to get the java.util.Date object for backward compatibility? We are surprised that a nightly build of smartgwt 3.0 contains changed signatures of this type.
Announcement
Collapse
No announcement yet.
X
-
There doesn't appear to have been a signature change here..
Did you really mean ListGrid.getAttributeAsDate(), or did you actually mean Record.getAttributeAsDate()?
If on a ListGrid, what attribute are you accessing?
When you say it is "no longer returning a serializable java.util.Date object", do you mean that it returns null, or something else?
-
Sorry, to be more specific in the base class down the hierarchy of ListGridRecord -> Record -> RefDataClass -> DataClass the method getAttributeAsDate() returns the results from calling the method JSOHelper.getAttributeAsDate(jsObj, property); It is this method as shown below that is causing the problem.
public static native Date getAttributeAsDate(JavaScriptObject elem, String attr) /*-{
var jsD = elem[attr];
if (jsD == null || jsD === undefined) {
return null;
} else {
var ret;
if (jsD.logicalDate) {
ret = @com.smartgwt.client.util.LogicalDate::new(D)(jsD.getTime());
} else if (jsD.logicalTime) {
ret = @com.smartgwt.client.util.LogicalTime::new(D)(jsD.getTime());
} else {
ret = @com.smartgwt.client.util.JSOHelper::toDate(D)(jsD.getTime());
}
return ret;
}
}-*/;
Comment
-
Yes, I meant to say Record.getAttributeAsDate().
No, its not returning null, it returns a LogicalDate object instead of a Date object. It looks like the LogicalDate class was added sometime after 10/25/12 and was not present before this in the 3.0 codestream.
This instance of LogicalDate does not seem to be getting serialized properly where java.util.Date was. Again, this breaks a whole multitude of our service calls. I would hope that this method being in the same release number would continue to return the same data type.
Comment
-
Again, LogicalDate is a trivial subclass of Date, in Java parlance it is an instanceof Date.
It also does not have any behavior differences relative to Date.
You should look into how this could possibly break your downstream code, as it suggests that someone has written some naive code that does something like obj.getClass().getName().equals("java.util.Date") to detect Dates whereas an instanceof check should have been used instead. If this kind of thing is the cause, then the same code would break with any subclass of Date, which is common usage in Java.
Let us know if we can help; as of now, as there was no signature change or behavior change, we don't plan to reverse this bugfix.
Comment
-
I have same or similar problem.
GWT is throwing exception:
Code:com.google.gwt.user.client.rpc.SerializationException
Code:com.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.getObjectTypeSignature
Looking deeper it turns out inside object:
Code:com.google.gwt.user.client.rpc.impl.SerializerBase
Code:Map<String, String> signatureMapJava
Code:com.smartgwt.client.util.LogicalDate
Code:signatureMapJava.get(clazz.getName());
BR
Marije
Comment
-
Can you clarify how this arises - presumably you are using a GWT-RPC service? If so, it seems like your RPC service is not regarding LogicalDate as serializable but by the basic rules of Java, it clearly is serializable.
So is the problem possibly that you need to run a new GWT compile and/or clear your GWT unitcache?
Comment
-
Hi,
well it is better but still not working.
I am getting following exception:
Code:[WARN] saporderServlet: An IncompatibleRemoteServiceException was thrown while processing this call. com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: java.lang.NumberFormatException: Expected type 'int' but received a non-numerical value: TqXrXRb at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:323) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:206) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488) Caused by: com.google.gwt.user.client.rpc.SerializationException: java.lang.NumberFormatException: Expected type 'int' but received a non-numerical value: TqXrXRb at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserialize(ServerSerializationStreamReader.java:689) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.readObject(ServerSerializationStreamReader.java:567) at com.google.gwt.user.server.rpc.core.java.util.Collection_ServerCustomFieldSerializerBase.deserialize(Collection_ServerCustomFieldSerializerBase.java:38) at com.google.gwt.user.server.rpc.core.java.util.ArrayList_ServerCustomFieldSerializer.deserialize(ArrayList_ServerCustomFieldSerializer.java:40) at com.google.gwt.user.server.rpc.core.java.util.ArrayList_ServerCustomFieldSerializer.deserializeInstance(ArrayList_ServerCustomFieldSerializer.java:54) at com.google.gwt.user.server.rpc.core.java.util.ArrayList_ServerCustomFieldSerializer.deserializeInstance(ArrayList_ServerCustomFieldSerializer.java:33) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeImpl(ServerSerializationStreamReader.java:859) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserialize(ServerSerializationStreamReader.java:662) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.readObject(ServerSerializationStreamReader.java:567) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader$ValueReader$8.readValue(ServerSerializationStreamReader.java:140) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeValue(ServerSerializationStreamReader.java:425) at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:312) ... 22 more Caused by: java.lang.NumberFormatException: Expected type 'int' but received a non-numerical value: TqXrXRb at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.getNumberFormatException(ServerSerializationStreamReader.java:999) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.readInt(ServerSerializationStreamReader.java:537) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.readObject(ServerSerializationStreamReader.java:552) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader$ValueReader$8.readValue(ServerSerializationStreamReader.java:140) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeValue(ServerSerializationStreamReader.java:425) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeClass(ServerSerializationStreamReader.java:807) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeImpl(ServerSerializationStreamReader.java:878) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserialize(ServerSerializationStreamReader.java:662) ... 33 more com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: java.lang.NumberFormatException: Expected type 'int' but received a non-numerical value: TqXrXRb at com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException_FieldSerializer.instantiate(IncompatibleRemoteServiceException_FieldSerializer.java:16) at com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException_FieldSerializer.create(IncompatibleRemoteServiceException_FieldSerializer.java:25) at com.google.gwt.user.client.rpc.impl.SerializerBase.instantiate(SerializerBase.java:115) at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.deserialize(ClientSerializationStreamReader.java:396) at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:119) at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:216) at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287) at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395) at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) at com.google.gwt.core.client.impl.Impl.apply(Impl.java) at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242) at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) at java.lang.Thread.run(Unknown Source)
Is this indicative for you or you want more traces?
Thanks.
BR
Marije
Comment
-
It turns out GWT-RPC just fails in general to serialize subclasses of date. We had to add custom serializers to work around this, and we've done so in 3.0p, 3.1d and 4.0d branches.
This might be a good one to add to the list of very good reasons not to use GWT-RPC.
Comment
Comment