gpt4 book ai didi

GWT 在托管模式下运行良好,并且编译没有错误——但它的 JS 文件有问题

转载 作者:行者123 更新时间:2023-12-04 06:17:40 26 4
gpt4 key购买 nike

我在编译或托管模式过程中都没有出现错误,但是 GWT 创建的 JS 包含不允许正确呈现网站的错误。这怎么会发生?这是编译器的问题吗?

FireBug 什么也没给我,根本没有错误。

但是我不知道从哪里开始,也不知道要给大家提供什么更多信息,因为我无法像这样有效地调试 JS。更根本的是,我只是不明白为什么 GWT 给我的 JS 不起作用。

编辑:直到现在我才真正知道漂亮和详细是什么意思。谢谢你给我指出这一点。我现在得到的是http://i.imgur.com/qUyNb.png .

我不知道从这里去哪里。

编辑 2:这是我将发布的最终图片(我保证!):http://i.imgur.com/ZVQVW.png .这是漂亮的输出。错误内容为:“未捕获的 com.google.gwt.core.client.JavaScriptException (TypeError):无法调用 null 的方法‘isString’(匿名函数)。”

最佳答案

这个问题的解决方案是意识到 isString 不是 JNSI 方法,而是我在 try/catch 块中编写的方法。这是让我绊倒的代码:

try{something that will create a NullPointerException}
catch(NullPointerException npe){npe.printStackTrace()}

@Luismahou 上面的链接对 GWT 中的错误捕获做了以下说明:

Exceptions: try, catch, finally and user-defined exceptions are supported as normal, although Throwable.getStackTrace() is not meaningfully supported in production mode. Note: Several fundamental exceptions implicitly produced by the Java VM, most notably NullPointerException, StackOverflowError, and OutOfMemoryError, do not occur in production mode as such. Instead, a JavaScriptException is produced for any implicitly generated exceptions. This is because the nature of the underlying JavaScript exception cannot be reliably mapped onto the appropriate Java exception type.



我认为发生的事情是我的 try 块抛出了一个 NullPointerException,它被表示为一个 JavaScriptException 并且未被 catch 块捕获。经验教训:不要在 GWT 中捕获 NullPointerExceptions、StackOverflowErrors 和 OutOfMemoryErrors。

关于GWT 在托管模式下运行良好,并且编译没有错误——但它的 JS 文件有问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7018686/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com