从 JSNI 方法返回了 int 以外的东西 [英] Something other than an int was returned from JSNI method
问题描述
我正在以托管模式运行 GWT 应用程序.我偶尔会收到一个奇怪的 HostedModeException
抱怨从 JSNI 返回的 JS 值的类型.有时是在反序列化期间:
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)
有时在:
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)
再次在
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)
有人可以帮我解决这个问题吗?我使用的是 GWT 2.4.0、Google Chrome 16.0.912.75 和 GWT Developer Plugin 1.0.9738.
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.
推荐答案
出于某种神奇的原因,chrome 与 GWT DevMode 的工作非常糟糕.解析 JSON 时随机空指针异常,使用 GXT 时 JSNI 返回类型错误,远程死亡异常是一个非常常见的问题.这是一个已知问题,这就是为什么大多数人没有在 Chrome 中使用 GWT DevMode.
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.
这篇关于从 JSNI 方法返回了 int 以外的东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!