Bug issue with for Defaults.asPrimitiveXXX

4 views
Skip to first unread message

eliasbalasis

unread,
Dec 27, 2007, 5:50:29 PM12/27/07
to GWT Jsonizer
when org.juglar.gwt.jsonizer.client.base.Defaults.asPrimitiveLong is
called as a result of an attempt to deJsonize an int property of a
Java object from its equivalent JavaScript object produces the
following error in GWT Hosted mode

[WARN] Exception thrown into JavaScript
com.google.gwt.dev.shell.HostedModeException:
invokeNativeLong(@org.juglar.gwt.jsonizer.client.base.Defaults::asPrimitiveLong(Lcom/
google/gwt/core/client/JavaScriptObject;)): JS value of type
JavaScript object, expected long
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
481)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeHandle(ModuleSpace.java:
225)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeHandle(JavaScriptHost.java:
89)
at
org.juglar.gwt.jsonizer.client.base.BeanJsonizer.setProperties(BeanJsonizer.java:
69)
at
org.juglar.gwt.jsonizer.client.base.BeanJsonizer.asJavaObject(BeanJsonizer.java:
104)
at
org.juglar.gwt.jsonizer.client.JsonizerParser.parse(JsonizerParser.java:
48)
at com.google.gwt.sample.eclipseWTP.client.MyGWT
$7.widgetSelected(MyGWT.java:158)
at
net.mygwt.ui.client.event.TypedListener.handleEvent(TypedListener.java:
74)
at net.mygwt.ui.client.util.EventTable.sendEvent(EventTable.java:121)
at net.mygwt.ui.client.util.Observable.fireEvent(Observable.java:92)

When asPrimitiveLong is called the passed object is of type 'object'
and not 'number' as expected, so I used
'return parseint(jsValue);' instead of 'return jsValue;' and it
worked.
I suspect related errors may occur in related cases
(asPrimitiveDouble, asPrimitiveBoolean)

Can you please include the fix or a better one in your next release?
Reply all
Reply to author
Forward
0 new messages