Integrated Ray's change from
http://gwt-code-reviews.appspot.com/932802/show. There were two other
places where null was converted to a string: ClientRequestHelper
(client) wrapped everything in a string and
JsonRequestProcessor.getParameterMap (server) requested a string even if
the value was null. I also moved a null check in JsonRqeuestProccesor
above the handling of Lists parameters.

Additionally, lists are sent over the wire as a single string (ex.
"[nonnull,null,null]") where "nonnull" and the first "null" are strings,
but the second "null" is actually null.  The server has no way to know
if null is a string or null.  I changed RequestData to wrap strings in
quotes, so JSONArray can parse it correctly. We also have to do a null
check before getting the string out of the array, because
JSONArray.getString() will return "null" instead of null. This is safe
because we treat all parameter values as strings anyway, and use
decodeParamterValue to convert them to the correct object, so it will
work for Lists of non strings.  The only reason it used to sort of work
is that JSONArray would decode [nonnull,null] as "nonnull","null", even
though they aren't wrapped in quotes.

RequestFactory now handles null parameters, even if the parameter is a
List or in a List.  However, setting an Entity to null (ex.
myFoo.setBar(null)) still fails.  This is a slightly more complicated
problem where generated code uses the instance to get the type of the
entity. If the instance is null, we get an NPE on the client. That test
will remain disabled for now.


http://gwt-code-reviews.appspot.com/931802/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to