I've spent a huge amount of time trying to find the source of one strange 
bug in my app, so I want to share what I've found.
First I should say I'm using GWT 2.3 currently, so i don't know if the 
described behavior changed in latest version.

My app is receiving some data from my server, displays it and after some 
user actions send something from this data back to the server.
I’ve used standart GWT RPC for this data exchange and everything was fine.
Then we decided to receive that data via JSON requests and here my trubles 
started: trying to send data back to the server (with the old GWT RPC 
method) throwed the com.google.gwt.user.client.rpc.SerializationException: 
undefined at Unknown.anonymous(Unknown Source).

Well, I’m not going to tell all the steps how I’ve found the problem, just 
the result.
My data class looks like this: 
public final class MyDataObj  extends JavaScriptObject {
//… NoArgs constructor and other stuff
public final native Ineger getMyDataVal() /*-{ return this.myDataVal; }-*/;
}

I’ve used Integer and not int here because null value is perfectly valid 
here and has its own meaning.
But in JSON this was a normal JavaScript integer or the absence of the 
property.
It was fine. Just until GWT had to serialize this Integer for RPC. Or until 
I’ve tried to use toString() or intValue() on it. That fails, since this 
was not an Integer.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/qMjpqA8NryEJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to