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

NPE when typing in an empty HTMLEditor under Linux GTK

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • 9
    • 8u45
    • javafx
    • x86
    • linux

      FULL PRODUCT VERSION :
      Oracle 1.8.0_45
      OpenJDK 1.8.0_60

      ADDITIONAL OS VERSION INFORMATION :
      Debian stretch x64

      A DESCRIPTION OF THE PROBLEM :
      When trying to type anything into an empty HTMLEditor the following error occurs. Using the same code under Windows 10 x64 does not produce any errors.

      Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
      at com.sun.javafx.scene.web.skin.HTMLEditorSkin.applyTextFormatting(HTMLEditorSkin.java:1086)
      at com.sun.javafx.scene.web.skin.HTMLEditorSkin.lambda$new$3(HTMLEditorSkin.java:291)
      at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
      at javafx.event.Event.fireEvent(Event.java:198)
      at javafx.scene.Scene$KeyHandler.process(Scene.java:3965)
      at javafx.scene.Scene$KeyHandler.access$1800(Scene.java:3911)
      at javafx.scene.Scene.impl_processKeyEvent(Scene.java:2040)
      at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2502)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:197)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:147)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$349(GlassViewEventHandler.java:228)
      at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:404)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:227)
      at com.sun.glass.ui.View.handleKeyEvent(View.java:546)
      at com.sun.glass.ui.View.notifyKey(View.java:956)
      at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
      at com.sun.glass.ui.gtk.GtkApplication.lambda$null$48(GtkApplication.java:139)
      at java.lang.Thread.run(Thread.java:745)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Using the Oracle sample under the system I described produces the error:
      https://docs.oracle.com/javafx/2/ui_controls/HTMLEditorSample.java.html


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package htmleditorsample;

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.geometry.Insets;
      import javafx.geometry.Pos;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.control.*;
      import javafx.scene.layout.VBox;
      import javafx.scene.web.HTMLEditor;
      import javafx.scene.web.WebEngine;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;
       
      public class HTMLEditorSample extends Application {
          private final String INITIAL_TEXT = "Lorem ipsum dolor sit "
                  + "amet, consectetur adipiscing elit. Nam tortor felis, pulvinar "
                  + "in scelerisque cursus, pulvinar at ante. Nulla consequat"
                  + "congue lectus in sodales. Nullam eu est a felis ornare "
                  + "bibendum et nec tellus. Vivamus non metus tempus augue auctor "
                  + "ornare. Duis pulvinar justo ac purus adipiscing pulvinar. "
                  + "Integer congue faucibus dapibus. Integer id nisl ut elit "
                  + "aliquam sagittis gravida eu dolor. Etiam sit amet ipsum "
                  + "sem.";
       
          @Override
          public void start(Stage stage) {
              stage.setTitle("HTMLEditor Sample");
              stage.setWidth(500);
              stage.setHeight(500);
              Scene scene = new Scene(new Group());
          
              VBox root = new VBox();
              root.setPadding(new Insets(8, 8, 8, 8));
              root.setSpacing(5);
              root.setAlignment(Pos.BOTTOM_LEFT);
       
              final HTMLEditor htmlEditor = new HTMLEditor();
              htmlEditor.setPrefHeight(245);
              htmlEditor.setHtmlText(INITIAL_TEXT);
              
              final WebView browser = new WebView();
              final WebEngine webEngine = browser.getEngine();
              
           
              ScrollPane scrollPane = new ScrollPane();
              scrollPane.getStyleClass().add("noborder-scroll-pane");
              scrollPane.setStyle("-fx-background-color: white");
              scrollPane.setContent(browser);
              scrollPane.setFitToWidth(true);
              scrollPane.setPrefHeight(180);
       
              Button showHTMLButton = new Button("Load Content in Browser");
              root.setAlignment(Pos.CENTER);
              showHTMLButton.setOnAction(new EventHandler<ActionEvent>() {
                  @Override public void handle(ActionEvent arg0) {
                      webEngine.loadContent(htmlEditor.getHtmlText());
                  }
              });
              
              root.getChildren().addAll(htmlEditor, showHTMLButton, scrollPane);
              scene.setRoot(root);
       
              stage.setScene(scene);
              stage.show();
          }
       
          public static void main(String[] args) {
              launch(args);
          }
      }
      ---------- END SOURCE ----------

            leifs Leif Samuelsson (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: