JavaFX Webview抛出StringIndexOutOfBoundsException

时间:2018-04-30 22:52:44

标签: javafx printing webview stringindexoutofbounds

在某些网站上,JavaFX Webview会抛出StringIndexOutOfBoundsExceptions。

        WebView browser = new WebView();
        WebEngine webEngine = browser.getEngine();
        setTop(browser);
        webEngine.load("https://stackoverflow.wordpress.com");

我得到以下输出:

java.lang.StringIndexOutOfBoundsException: String index out of range: 4
at java.lang.String.substring(Unknown Source)
at com.sun.javafx.webkit.prism.WCFontImpl.getGlyphsAndAdvances(WCFontImpl.java:120)
at com.sun.webkit.network.URLLoader.twkDidReceiveData(Native Method)
at com.sun.webkit.network.URLLoader.notifyDidReceiveData(URLLoader.java:844)
at com.sun.webkit.network.URLLoader.lambda$didReceiveData$102(URLLoader.java:819)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
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$148(WinApplication.java:191)
at java.lang.Thread.run(Unknown Source)

关于其他网址i.E. “http://www.google.de”没有错误。

我可以避免打印此堆栈跟踪,还是可以避免抛出此错误? WebView正确加载所有网站,但这些堆栈跟踪很烦人。

0 个答案:

没有答案
相关问题