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);
}
@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);
}
- duplicates
-
JDK-8093709 XYChart Series: NullPointerException when changing Series which is not assigned to a chart
- Resolved
- relates to
-
JDK-8090982 [XYChart] data association to chart/series should be more transparent
- Open