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

XYChart Series: NullPointerException when changing Series which is not assigned to a chart

XMLWordPrintable

      In my application series are added to a chart dynamically but the data of the series is updated ongoing.

      If a series is changed which is not shown in a chart a NPE is thrown:
      java.lang.NullPointerException
       at javafx.scene.chart.XYChart$Series$1.onChanged(XYChart.java:1507)
       at com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:158)
       at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:72)
       at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
       at javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
       at javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
       at javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205)
       at javafx.collections.ModifiableObservableListBase.add(ModifiableObservableListBase.java:155)
       at java.util.AbstractList.add(AbstractList.java:108)

      Reason: At line 1507 in XYChart the getChart() method is not null checked...

            msladecek Martin Sládeček
            aliebelt Andreas Liebelt
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: