NullPointerException in WCPageBackBufferImpl when a WebView is too large

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 8u60, 9
    • Component/s: javafx
    • web
    • Cause Known
    • x86
    • windows_7

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

      ADDITIONAL OS VERSION INFORMATION :
      Window 7

      A DESCRIPTION OF THE PROBLEM :
      NullPointerException during layout when WebView width is over 8500.
      This happens at least when WebView is inside a group.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Just run the sample application below and change the PrefWidth.
      Over 8500 pixel, WebView crash
      Below 800 pixel, it does'nt.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Executing D:\home\dev\JavaFxExamples\HtmlEditor\dist\run440091430\HtmlEditorSample.jar using platform C:\Program Files (x86)\Java\jdk1.8.0_60\jre/bin/java
      java.lang.NullPointerException
      at com.sun.javafx.webkit.prism.WCPageBackBufferImpl.validate(WCPageBackBufferImpl.java:97)
      at com.sun.webkit.WebPage.paint(WebPage.java:656)
      at com.sun.javafx.sg.prism.web.NGWebView.renderContent(NGWebView.java:96)
      at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2053)
      at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1945)
      at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:235)
      at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2053)
      at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1945)
      at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:477)
      at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:330)
      at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:91)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
      at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
      at java.lang.Thread.run(Thread.java:745)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;

      public class WebViewCrashIfTooLarge extends Application {

          @Override
          public void start(Stage stage) throws InterruptedException {
              stage.setTitle("WebView crash if size is too large");
              stage.setWidth(500);
              stage.setHeight(500);
              final WebView webView = new WebView();
              webView.setPrefWidth(9000);
              Group group = new Group(webView);
              stage.setScene(new Scene(group));
              stage.show();
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      set the maxWidth and maxHeight of the webView seems a good by pass :

           sceneProperty().addListener(new ChangeListener<Scene>() {

                  @Override
                  public void changed(ObservableValue<? extends Scene> observable, Scene oldValue, Scene scene) {
                      if (scene != null) {
                          webView.setMaxSize(getScene().getWidth(), getScene().getHeight());
                          webView.maxWidthProperty().bind(getScene().widthProperty());
                          webView.maxHeightProperty().bind(getScene().heightProperty());
                      } else {
                          webView.maxWidthProperty().unbind();
                          webView.maxHeightProperty().unbind();
                      }
                  }
              });

            Assignee:
            Unassigned
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: