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

Charts: exception initializing in a background thread

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • jfx25
    • jfx23
    • javafx
    • b07

      AreaChart / BubbleChart / BarChart / LineChart / ScatterChart / StackedAreaChart / StackedBarChart fail to initialize in a background thread when adding a series, throwing an exception when
      binding to Platform.accessibilityActiveProperty().

      To reproduce, use the newly developed NodeInitializationStressTest:

      ```
          @Test
          public void lineChart() {
              test(() -> {
                  LineChart c = new LineChart(createNumberAxis("x"), createNumberAxis("y"));
                  c.getData().setAll(createNumberSeries());
                  return c;
              }, (c) -> {
                  c.getData().setAll(createNumberSeries());
                  accessChart(c);
              });
          }
      ```

      Exception (example):

      java.lang.ArrayIndexOutOfBoundsException: Index 712 out of bounds for length 709
      at javafx.base/com.sun.javafx.binding.ExpressionHelper$Generic.addListener(ExpressionHelper.java:248)
      at javafx.base/com.sun.javafx.binding.ExpressionHelper$Generic.addListener(ExpressionHelper.java:1)
      at javafx.base/com.sun.javafx.binding.ExpressionHelper.addListener(ExpressionHelper.java:65)
      at javafx.base/javafx.beans.property.ReadOnlyBooleanPropertyBase.addListener(ReadOnlyBooleanPropertyBase.java:52)
      at javafx.base/javafx.beans.property.BooleanPropertyBase.bind(BooleanPropertyBase.java:176)
      at javafx.graphics/javafx.css.StyleableBooleanProperty.bind(StyleableBooleanProperty.java:96)
      at javafx.controls/javafx.scene.chart.LineChart.createSymbol(LineChart.java:533)
      at javafx.controls/javafx.scene.chart.LineChart.seriesAdded(LineChart.java:427)
      at javafx.controls/javafx.scene.chart.XYChart.lambda$0(XYChart.java:166)
      at javafx.base/com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:162)
      at javafx.base/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:71)
      at javafx.base/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:246)
      at javafx.base/javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
      at javafx.base/javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
      at javafx.base/javafx.collections.ObservableListBase.endChange(ObservableListBase.java:210)
      at javafx.base/javafx.collections.ModifiableObservableListBase.setAll(ModifiableObservableListBase.java:102)
      at javafx.base/javafx.collections.ObservableListBase.setAll(ObservableListBase.java:264)
      at test.robot.javafx.scene.NodeInitializationBackgroundThreadTest.lambda$27(NodeInitializationBackgroundThreadTest.java:305)
      at test.robot.javafx.scene.NodeInitializationBackgroundThreadTest$1.run(NodeInitializationBackgroundThreadTest.java:481)


      Root Cause:
      (Multiple) properties are getting bound to the global Platform.accessibilityActive property. Binding (and I say, accessing) of properties is not thread-safe.

            angorya Andy Goryachev
            angorya Andy Goryachev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: