Project: Birt
Bug 242455 NPE when painting chart with null data sets
Reported: 2008-07-29 14:41:41 | Status: resolved fixed

Build ID: I20080617-2000 Steps To Reproduce: I've got charts that throw a NPE when they are painted without data. When I first build the charts, I attach a series to both axis, but the series don't have datasets yet (they are null). In my application, I don't always have the data before I want to show the chart (just the axis, labels, etc.) This was code that was working with BIRT 2.2 but is now broken with 2.3. It appears the introduction of the DeferredCacheManager introduced the problem. Creating initial datasets with a single 0,0 type value was a sufficient workaround for now, but not optimal. java.lang.NullPointerException at org.eclipse.birt.chart.render.DeferredCacheManager.createDeferredCache(DeferredCacheManager.java:83) at org.eclipse.birt.chart.factory.Generator.render(Generator.java:1344) at com.initiatesystems.workbench.analysis.queries.ScoreDistributionChart.paintControl(ScoreDistributionChart.java:323) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:217) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012) at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:1424) More information:

Files changed in fix:
chart/org.eclipse.birt.chart.engine/src/org/eclipse/birt/chart/computation/LegendBuilder.java chart/org.eclipse.birt.chart.engine/src/org/eclipse/birt/chart/render/BaseRenderer.java chart/org.eclipse.birt.chart.engine/src/org/eclipse/birt/chart/render/DeferredCacheManager.java