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

ComboBox accepts setItems(null) but later throws NPE when layout() is called.

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 7u10
    • 8
    • javafx

    Description

      See subject.

      ComboBox should either reject null in setItems(), or guard against null without failing during layout().

      See attached example. The exception should have happened in FXMLLoader.load(), not in javafx.scene.Parent.layout() - or it shouldn't have happened at all.

      SEVERE: null
      java.lang.NullPointerException
      at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin.getIndexOfComboBoxValueInItemsList(ComboBoxListViewSkin.java:444)
      at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin.updateDisplayNode(ComboBoxListViewSkin.java:392)
      at com.sun.javafx.scene.control.skin.ComboBoxListViewSkin.getDisplayNode(ComboBoxListViewSkin.java:229)
      at com.sun.javafx.scene.control.skin.ComboBoxBaseSkin.updateDisplayArea(ComboBoxBaseSkin.java:125)
      at com.sun.javafx.scene.control.skin.ComboBoxBaseSkin.computePrefHeight(ComboBoxBaseSkin.java:180)
      at javafx.scene.Parent.prefHeight(Parent.java:879)
      at javafx.scene.layout.Region.prefHeight(Region.java:1384)
      at javafx.scene.control.Control.computePrefHeight(Control.java:804)
      at javafx.scene.Parent.prefHeight(Parent.java:879)
      at javafx.scene.control.Control.prefHeight(Control.java:686)
      at javafx.scene.layout.Region.computeChildPrefAreaHeight(Region.java:1599)
      at javafx.scene.layout.AnchorPane.computeChildHeight(AnchorPane.java:296)
      at javafx.scene.layout.AnchorPane.layoutChildren(AnchorPane.java:327)
      at javafx.scene.Parent.layout(Parent.java:1018)
      at javafx.scene.Scene.layoutDirtyRoots(Scene.java:513)
      at javafx.scene.Scene.doLayoutPass(Scene.java:484)
      at javafx.scene.Scene.preferredSize(Scene.java:1485)
      at javafx.scene.Scene.impl_preferredSize(Scene.java:1512)
      at javafx.stage.Window$10.invalidated(Window.java:719)
      at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:127)
      at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:161)
      at javafx.stage.Window.setShowing(Window.java:782)
      at javafx.stage.Window.show(Window.java:797)
      at javafx.stage.Stage.show(Stage.java:229)
      at loadfxml.Main.start(Main.java:47)
      at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
      at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:207)
      at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173)
      at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)

      Attachments

        Issue Links

          Activity

            People

              jgiles Jonathan Giles
              dfuchs Daniel Fuchs
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: