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

IOOBE when adding data to a Series of a BarChart that already contains data

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • jfx24
    • jfx22
    • javafx
    • None
    • b05

      Adding additional data to a Series that is already part of a BarChart and that already contains data may cause an IndexOutOfBoundsException.

      Specifically, this test fails with an IOOBE when added to BarChartTest.java:

      @Test
      public void testAddingDataToNonEmptySeries() {
      Thread.currentThread().setUncaughtExceptionHandler((t, e) -> Assert.fail("Exception: " + e));
      startApp();
      BarChart<String, Number> chart = new BarChart<>(new CategoryAxis(), new NumberAxis());
      XYChart.Series<String, Number> series = new XYChart.Series<>();
      series.getData().add(new XYChart.Data<>("1", 1));
      chart.getData().add(series);
      series.getData().add(new XYChart.Data<>("2", 2));
      assertEquals(2, XYChartShim.Series_getDataSize(series));
      assertEquals(2, XYChartShim.getPlotChildren(chart).size());
      }

      Exception: java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
      java.lang.AssertionError: Exception: java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
      at org.junit.Assert.fail(Assert.java:89)
      at test.javafx.scene.chart.BarChartTest.lambda$testAddingDataToNonEmptySeries$1(BarChartTest.java:302)
      at javafx.base@23-internal/com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:164)
      at javafx.base@23-internal/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:71)
      at javafx.base@23-internal/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:246)
      at javafx.base@23-internal/javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
      at javafx.base@23-internal/javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
      at javafx.base@23-internal/javafx.collections.ObservableListBase.endChange(ObservableListBase.java:210)
      at javafx.base@23-internal/javafx.collections.ModifiableObservableListBase.add(ModifiableObservableListBase.java:200)
      at java.base/java.util.AbstractList.add(AbstractList.java:113)
      at test.javafx.scene.chart.BarChartTest.testAddingDataToNonEmptySeries(BarChartTest.java:308)

      This looks similar like the IOOBE that was the issue in JBS-8088923, but has a different cause.

            mmack Markus Mack
            mmack Markus Mack
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: