Something other than an int was returned from JSNI method
Asked Answered
S

1

18

I am running a GWT application in hosted mode. Sporadically I get a strange HostedModeException complaining about the type of the JS value returned from JSNI. Sometimes it is during deserialization:

 com.google.gwt.dev.shell.HostedModeException: Something other than an int was returned from JSNI method '@com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader::readInt()': JS value of type boolean, expected int
    at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:266)
    at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:144)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:247)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:75)
    at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.readInt(ClientSerializationStreamReader.java)

sometimes at:

 com.google.gwt.dev.shell.HostedModeException: Something other than an int was returned from JSNI method '@com.google.gwt.user.client.impl.DOMImpl::eventGetTypeInt(Ljava/lang/String;)': JS value of type null, expected int
    at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:266)
    at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:144)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:247)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:75)
    at com.google.gwt.user.client.impl.DOMImpl.eventGetTypeInt(DOMImpl.java)
    at com.google.gwt.user.client.impl.DOMImpl.eventGetTypeInt(DOMImpl.java:62)
    at com.google.gwt.user.client.DOM.eventGetType(DOM.java:602)
    at com.google.gwt.user.client.Event$.getTypeInt$(Event.java:695)
    at com.extjs.gxt.ui.client.util.BaseEventPreview.onPreviewNativeEvent(BaseEventPreview.java:139)

once again at

com.google.gwt.dev.shell.HostedModeException: Something other than a float was returned from JSNI method '@com.extjs.gxt.ui.client.util.Util::parseFloat(Ljava/lang/String;F)': JS value of type boolean, expected float
    at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:118)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeFloat(ModuleSpace.java:235)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeFloat(JavaScriptHost.java:67)
    at com.extjs.gxt.ui.client.util.Util.parseFloat(Util.java)
    at com.extjs.gxt.ui.client.core.El.getFrameSize(El.java:1081)
    at com.extjs.gxt.ui.client.core.El.setSize(El.java:2702)
    at com.extjs.gxt.ui.client.widget.BoxComponent.setSize(BoxComponent.java:501)
    at com.extjs.gxt.ui.client.widget.BoxComponent.setHeight(BoxComponent.java:320)

Can anyone help me on this? I am using GWT 2.4.0, Google Chrome 16.0.912.75 and GWT Developer Plugin 1.0.9738.

Struve answered 18/1, 2012 at 16:23 Comment(3)
I would like to help, as I also get this kind of random Exception every now and then... but I have no idea! Anyway, it doesn't affect my debugging usually, so I just live with it... but it would be nice to know what's behind that.Teepee
May case was like yours, happened once a month or so, but now in the project I am currently working on this is happening recurrently, many times a day. That's why I feel there may be something wrong with my configuration. Unfortunately it is also difficult to reproduce. In jusio's word, it's magical.Struve
This question is duplicated at #9984798 where a work-around is given.Rival
L
16

For some magical reason chrome works very badly with GWT DevMode. Random null pointer exception while parsing JSON, JSNI return types errors when working with GXT, remote death exceptions are a very common problems. It is known problem and that's why most people are not using GWT DevMode with Chrome.

Laidlaw answered 18/1, 2012 at 16:28 Comment(5)
Strange, as they both come from Google. Actually I have a legacy application here and porting to Firefox needs additional effort :(Struve
strange indeed, we had to create separate JSON parser for our project, because DevMode in Chrome was always crushing with standard implementation. Unfortunately there is no such workarounds for frameworks like GXT.Laidlaw
Worth pointing out that this only happens in dev mode (compiled code will be fine), and only with some jsni, some of the time). This is a longstanding problem, and will eventually happen with any jsni. code.google.com/p/google-web-toolkit/issues/detail?id=5778Hopscotch
Thanks Colin, I find it strange again, as this bug was filed in Dec 2010 and is about GWT 2.1.0 and and Chrome 10.0.612.1. Centuries have passed since then.Struve
This happens with IE 10 as well (Windows 8 if that matters)Underexpose

© 2022 - 2024 — McMap. All rights reserved.