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

[FXCanvas, JFXPanel] NPE in Browser while pressing back/forward buttons from mouse

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u20
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Labels:
    • Environment:

      Fedora 20 x64, Windows 7 x64 with 32bit java
      Oracle java7u51, java8u5, mouse with 5 buttons

      Description

      I have 5-buttons mouse, by default in Linux and Windows additional buttons actions in browser is back and forward. It works fine in Firefox but in JavaFx WebView I got NPE.

      Code example:

      import org.eclipse.swt.SWT;
      import org.eclipse.swt.layout.FillLayout;
      import org.eclipse.swt.widgets.Composite;
      import org.eclipse.swt.widgets.Display;
      import org.eclipse.swt.widgets.Shell;

      import javafx.embed.swt.FXCanvas;
      import javafx.scene.Scene;
      import javafx.scene.web.WebEngine;
      import javafx.scene.web.WebView;

      public class SampleApp extends FXCanvas {
      public SampleApp(Composite parent) {
      super(parent, SWT.NONE);
      WebView browser = new WebView();
      this.setScene(new Scene(browser));
      WebEngine webEngine = browser.getEngine();
      webEngine.load("http://www.oracle.com");
      }

      public static void main(String[] args) {
      Display display = new Display();
      Shell shell = new Shell(display);
      shell.setLayout(new FillLayout());

      SampleApp app = new SampleApp(shell);
      shell.open();
      while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
      display.sleep();
      }
      display.dispose();
      }
      }

      Stacktrace(two NPEs per one click):
      Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
      at javafx.scene.Scene$ClickCounter.access$7400(Scene.java:3321)
      at javafx.scene.Scene$ClickGenerator.preProcess(Scene.java:3417)
      at javafx.scene.Scene$ClickGenerator.access$8100(Scene.java:3387)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3724)
      at javafx.scene.Scene$MouseHandler.access$1800(Scene.java:3471)
      at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1695)
      at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2486)
      at com.sun.javafx.tk.quantum.EmbeddedScene$2$1.run(EmbeddedScene.java:260)
      at com.sun.javafx.tk.quantum.EmbeddedScene$2$1.run(EmbeddedScene.java:246)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.EmbeddedScene$2.run(EmbeddedScene.java:246)
      at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
      at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
      at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
      at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2473)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3414)
      at org.jboss.tools.vpe.browsersim.browser.javafx.SampleApp.main(SampleApp.java:35)
      Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
      at javafx.scene.Scene$ClickCounter.access$7700(Scene.java:3321)
      at javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3452)
      at javafx.scene.Scene$ClickGenerator.access$8300(Scene.java:3387)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3755)
      at javafx.scene.Scene$MouseHandler.access$1800(Scene.java:3471)
      at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1695)
      at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2486)
      at com.sun.javafx.tk.quantum.EmbeddedScene$2$1.run(EmbeddedScene.java:260)
      at com.sun.javafx.tk.quantum.EmbeddedScene$2$1.run(EmbeddedScene.java:246)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.EmbeddedScene$2.run(EmbeddedScene.java:246)
      at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
      at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
      at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
      at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2473)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3414)
      at org.jboss.tools.vpe.browsersim.browser.javafx.SampleApp.main(SampleApp.java:35)

        Attachments

        1. MouseTest_RT37436.java
          4 kB
          Steve Northover
        2. MouseTestSwing.java
          2 kB
          Steve Northover

          Activity

            People

            • Assignee:
              snorthov Steve Northover (Inactive)
              Reporter:
              kmarmalyujfx Konstantin Marmalyukov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: