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

SwingNode: IllegalArgumentException about "null source" when closing combobox

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8u40
    • 8u11
    • javafx
    • Win7 64bit

      In a scene with a ComboBox and an empty SwingNode an IllegalArgumentException is thrown and printed to stderr each time the combobox dropdown is closed. The effect is similar to RT-30649.

      Stack trace:

      Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: null source
      at java.util.EventObject.<init>(EventObject.java:56)
      at java.awt.AWTEvent.<init>(AWTEvent.java:337)
      at sun.awt.UngrabEvent.<init>(UngrabEvent.java:48)
      at javafx.embed.swing.SwingNode$10.handle(SwingNode.java:414)
      at javafx.embed.swing.SwingNode$10.handle(SwingNode.java:410)
      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:49)
      at javafx.event.Event.fireEvent(Event.java:204)
      at com.sun.javafx.stage.WindowPeerListener.focusUngrab(WindowPeerListener.java:97)
      at com.sun.javafx.tk.quantum.GlassWindowEventHandler.run(GlassWindowEventHandler.java:92)
      at com.sun.javafx.tk.quantum.GlassWindowEventHandler.run(GlassWindowEventHandler.java:39)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.GlassWindowEventHandler.handleWindowEvent(GlassWindowEventHandler.java:130)
      at com.sun.glass.ui.Window.handleWindowEvent(Window.java:1235)
      at com.sun.glass.ui.Window.notifyFocusUngrab(Window.java:1219)
      at com.sun.glass.ui.win.WinWindow._ungrabFocus(Native Method)
      at com.sun.glass.ui.Window.ungrabFocus(Window.java:784)
      at com.sun.javafx.tk.quantum.WindowStage.ungrabFocus(WindowStage.java:748)
      at javafx.stage.Window.decreaseFocusGrabCounter(Window.java:1057)
      at javafx.stage.PopupWindow.handleAutohideActivation(PopupWindow.java:909)
      at javafx.stage.PopupWindow.impl_visibleChanged(PopupWindow.java:523)
      at javafx.stage.Window$9.invalidated(Window.java:799)
      at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:109)
      at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:143)
      at javafx.stage.Window.setShowing(Window.java:826)
      at javafx.stage.Window.hide(Window.java:851)
      at javafx.stage.PopupWindow.hide(PopupWindow.java:460)
      at com.sun.javafx.scene.control.skin.ComboBoxPopupControl.hide(ComboBoxPopupControl.java:79)
      at com.sun.javafx.scene.control.skin.ComboBoxBaseSkin.handleControlPropertyChanged(ComboBoxBaseSkin.java:117)
      at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin.handleControlPropertyChanged(ComboBoxListViewSkin.java:245)
      at com.sun.javafx.scene.control.skin.BehaviorSkinBase$2.call(BehaviorSkinBase.java:189)
      at com.sun.javafx.scene.control.skin.BehaviorSkinBase$2.call(BehaviorSkinBase.java:187)
      at com.sun.javafx.scene.control.MultiplePropertyChangeListenerHandler$1.changed(MultiplePropertyChangeListenerHandler.java:55)
      at javafx.beans.value.WeakChangeListener.changed(WeakChangeListener.java:89)
      at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:176)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
      at javafx.beans.property.ReadOnlyBooleanWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(ReadOnlyBooleanWrapper.java:178)
      at javafx.beans.property.ReadOnlyBooleanWrapper$ReadOnlyPropertyImpl.access$100(ReadOnlyBooleanWrapper.java:148)
      at javafx.beans.property.ReadOnlyBooleanWrapper.fireValueChangedEvent(ReadOnlyBooleanWrapper.java:144)
      at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
      at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:143)
      at javafx.scene.control.ComboBoxBase.setShowing(ComboBoxBase.java:202)
      at javafx.scene.control.ComboBoxBase.hide(ComboBoxBase.java:416)
      at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin$11.handle(ComboBoxListViewSkin.java:622)
      at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin$11.handle(ComboBoxListViewSkin.java:605)
      at com.sun.javafx.event.CompositeEventHandler$NormalEventFilterRecord.handleCapturingEvent(CompositeEventHandler.java:282)
      at com.sun.javafx.event.CompositeEventHandler.dispatchCapturingEvent(CompositeEventHandler.java:98)
      at com.sun.javafx.event.EventHandlerManager.dispatchCapturingEvent(EventHandlerManager.java:223)
      at com.sun.javafx.event.EventHandlerManager.dispatchCapturingEvent(EventHandlerManager.java:180)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchCapturingEvent(CompositeEventDispatcher.java:43)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:52)
      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:204)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3746)
      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)

      Example code. The problem can be "fixed" by avoiding an empty SwingNode.

      import javafx.application.Application;
      import javafx.embed.swing.SwingNode;
      import javafx.scene.Scene;
      import javafx.scene.control.ComboBox;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class NullSource extends Application
      {
        public static void main(String[] args)
        {
          Application.launch(args);
        }
        
        @Override
        public void start(Stage primaryStage) throws Exception
        {
          ComboBox<String> cb = new ComboBox<String>();
          cb.getItems().setAll("a", "b", "c");
          
          SwingNode sn = new SwingNode();
          // SwingUtilities.invokeLater(() -> {
          // sn.setContent(new JLabel("JLabel"));
          // });
          
          VBox root = new VBox(20, cb, sn);
          primaryStage.setScene(new Scene(root, 500, 300));
          primaryStage.show();
        }
      }

            anthony Anthony Petrov (Inactive)
            wlehmann Werner Lehmann
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: