webBrowser组件偶尔会引发异常的codenameone

时间:2016-02-17 11:10:04

标签: codenameone

我使用WebBrowser组件来查看偶尔会抛出异常的url,如果有异常则不会显示webBrowser。这是什么问题?我的代码就在最后。感谢

收到异常:未知主机

java.lang.Throwable: Unknown host
    at javafx.scene.web.WebEngine$LoadWorker.describeError(WebEngine.java:1402)
    at javafx.scene.web.WebEngine$LoadWorker.dispatchLoadEvent(WebEngine.java:1341)
    at javafx.scene.web.WebEngine$LoadWorker.access$1100(WebEngine.java:1219)
    at javafx.scene.web.WebEngine$PageLoadListener.dispatchLoadEvent(WebEngine.java:1206)
    at com.sun.webkit.WebPage.fireLoadEvent(WebPage.java:2387)
    at com.sun.webkit.WebPage.fwkFireLoadEvent(WebPage.java:2231)
    at com.sun.webkit.network.URLLoader.twkDidFail(Native Method)
    at com.sun.webkit.network.URLLoader.notifyDidFail(URLLoader.java:843)
    at com.sun.webkit.network.URLLoader.lambda$didFail$93(URLLoader.java:826)
    at com.sun.webkit.network.URLLoader$$Lambda$168/1472224915.run(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$null$164(PlatformImpl.java:292)
    at com.sun.javafx.application.PlatformImpl$$Lambda$64/2085765319.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(PlatformImpl.java:291)
    at com.sun.javafx.application.PlatformImpl$$Lambda$63/817822539.run(Unknown Source)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$141(WinApplication.java:102)
    at com.sun.glass.ui.win.WinApplication$$Lambda$55/1412924864.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:745)

我的代码:

InfiniteProgress ip = new InfiniteProgress();
f.addComponent(BorderLayout.NORTH, ip);
WebBrowser view = new WebBrowser() {

    @Override
    public void onStart(String url) {
        System.out.println("del ip");
        f.removeComponent(ip);
    }

};
view.setURL("https://docs.google.com/gview?embedded=true&url=" + pdfUrlSelected);
f.addComponent(BorderLayout.CENTER, view);
f.revalidate();

1 个答案:

答案 0 :(得分:0)

这通常意味着您的网络连接或DNS存在问题。

如果主持人没有发现网络无法继续。