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

Changing the root of a scene causes NullPointerException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 8u5
    • javafx
    • None

      Scenario:
      (1) Creating a scene with a root.
      (2) Setting another root for the scene.
      (3) Resulting in NulpointerException

      Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
      at javafx.scene.Node.localToScreen(Node.java:4164)
      at javafx.scene.Node.localToScreen(Node.java:4139)
      at javafx.scene.web.WebView.processMouseEvent(WebView.java:987)
      at javafx.scene.web.WebView.access$2500(WebView.java:76)
      at javafx.scene.web.WebView$14.handle(WebView.java:1130)
      at javafx.scene.web.WebView$14.handle(WebView.java:1128)
      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.EventUtil.fireEventImpl(EventUtil.java:74)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
      at javafx.event.Event.fireEvent(Event.java:204)
      at com.sun.javafx.event.EventQueue.fire(EventQueue.java:48)
      at javafx.scene.Scene$MouseHandler.handleEnterExit(Scene.java:3662)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3787)
      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.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:314)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:243)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:345)
      at com.sun.glass.ui.View.handleMouseEvent(View.java:526)
      at com.sun.glass.ui.View.notifyMouse(View.java:898)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
      at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
      at java.lang.Thread.run(Thread.java:745)

      In the class Node there is a check for "scene == null || window == null", but in the line above it states "window = scene.getWindow()". So if scene is null, it will cause a NullPointerException.

            msladecek Martin Sládeček
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: