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

[Charts] Series: NPE when adding data items after deletion of data

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8u40
    • 8u5
    • javafx

      Happens if the data had been deleted while the chart is null. Below is a failing code snippet, more details at SO http://stackoverflow.com/a/24533160/203657

          @Test
          public void testSeriesAddDeleteAdd() {
              Series<String, Number> series = new Series<String, Number>();
              Number value1 = new Integer(5);
              Number value2 = new Integer(6);
              Data<String, Number> point1 = new Data<String, Number>("Something", value1);
              Data<String, Number> point2 = new Data<String, Number>("Something", value2);
              series.getData().add(point1);
              series.getData().add(point2);
              // remove data
              series.getData().clear();

              Number value3 = new Integer(7);
              Data<String, Number> point3 = new Data<String, Number>("Something", value3);
              // add again: here's the NPE
              series.getData().add(point3);
          }

            msladecek Martin Sládeček
            fastegal Jeanette Winzenburg
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: