Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8144162

NullPointerException printed when loading webpage in WebView with anchor

    XMLWordPrintable

    Details

    • Subcomponent:
      web
    • CPU:
      x86
    • OS:
      linux_ubuntu

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.8.0_60"
        Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
        Java HotSpot(TM) Server VM (build 25.60-b23, mixed mode)


        ADDITIONAL OS VERSION INFORMATION :
        Linux banshee 3.13.0-63-generic #103-Ubuntu SMP Fri Aug 14 21:43:30 UTC 2015 i686 i686 i686 GNU/Linux

        A DESCRIPTION OF THE PROBLEM :
        When loading a web page in a new WebView, I frequently see this exception (note that none of my own code is in the call stack):

        Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
        at com.sun.javafx.webkit.theme.ScrollBarThemeImpl.getThumb(ScrollBarThemeImpl.java:409)
        at com.sun.javafx.webkit.theme.ScrollBarThemeImpl.thumbPosition(ScrollBarThemeImpl.java:293)
        at com.sun.javafx.webkit.theme.ScrollBarThemeImpl.getThumbPosition(ScrollBarThemeImpl.java:389)
        at com.sun.webkit.network.URLLoader.twkDidFinishLoading(Native Method)
        at com.sun.webkit.network.URLLoader.notifyDidFinishLoading(URLLoader.java:838)
        at com.sun.webkit.network.URLLoader.lambda$didFinishLoading$96(URLLoader.java:829)
        at com.sun.javafx.application.PlatformImpl.lambda$null$174(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
        at com.sun.glass.ui.gtk.GtkApplication.lambda$null$50(GtkApplication.java:139)



        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        My code to load the webpage is:

                WebView browser = new WebView();
                browser.getEngine().load(url);
                Tab tab = new Tab();
                tab.setGraphic(getWebIcon());
                tab.setContent(browser);
                tab.textProperty().bind(browser.getEngine().titleProperty());
                tabPane.getTabs().add(tab);
                tabPane.getSelectionModel().select(tab);

        Which I think is pretty standard. The problem occurs when viewing an HTML page with an anchor. The pages I am loading are Javadoc webpages -- links very similar to https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#contains-java.lang.CharSequence- but the links are file: links on my local machine to locally generated Javadoc

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        I expect not to have an exception. It does not seem to prevent the page displaying at the right location, but obviously an exception isn't right.
        ACTUAL -
        The exception included above.

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
        at com.sun.javafx.webkit.theme.ScrollBarThemeImpl.getThumb(ScrollBarThemeImpl.java:409)
        at com.sun.javafx.webkit.theme.ScrollBarThemeImpl.thumbPosition(ScrollBarThemeImpl.java:293)
        at com.sun.javafx.webkit.theme.ScrollBarThemeImpl.getThumbPosition(ScrollBarThemeImpl.java:389)
        at com.sun.webkit.network.URLLoader.twkDidFinishLoading(Native Method)
        at com.sun.webkit.network.URLLoader.notifyDidFinishLoading(URLLoader.java:838)
        at com.sun.webkit.network.URLLoader.lambda$didFinishLoading$96(URLLoader.java:829)
        at com.sun.javafx.application.PlatformImpl.lambda$null$174(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
        at com.sun.glass.ui.gtk.GtkApplication.lambda$null$50(GtkApplication.java:139)
        at java.lang.Thread.run(Thread.java:745)

        REPRODUCIBILITY :
        This bug can be reproduced often.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                arajkumar Arunprasad Rajkumar
                Reporter:
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: