Project: Birt
Bug 160517 ChartException when dataset empty and chart hidden
Reported: 2006-10-11 13:22:17 | Status: resolved fixed

We have a report which includes a couple of charts. One chart is always displayed because the data is always available. However, two of the charts have their visibility toggled depending on whether their data series is populated. The problem is that even when a chart is hidden, a ChartException is generated because the underlying dataset is empty. I expect the chart to not attempt to retrieve metadata or log an error in this circumstance. To prevent the exception, I've had to inject a "stub value" into the dataset within my custom Java dataset event handlers, which is messy. I suspect the chart engine is also wasting some CPU cycles doing extra work since I really don't want the chart rendered when there is no real data. In BIRT 2.1.0, the report engine would not even generate a PDF when this ChartException was thrown, so I was encouraged when I found that BIRT 2.1.1 generates the PDF despite the exception. However, since the errors are in our logs, I'm afraid I'm going to have to continue injecting stubbed data values. I am attaching a sample report with a single hidden chart that exhibits the behavior. The stacktrace : Oct 11, 2006 12:05:18 PM org.eclipse.birt.chart.internal.datafeed.ResultSetWrapper initializeMeta WARNING: Unable to determine data types from resultset Oct 11, 2006 12:05:18 PM org.eclipse.birt.chart.exception.ChartException logThis SEVERE: Exception org.eclipse.birt.chart.exception.ChartException: Empty dataset found at org.eclipse.birt.chart.datafeed.DataSetProcessorImpl.populate(DataSetProcessorImpl.java:248) at org.eclipse.birt.chart.internal.datafeed.DataProcessor.fillSeriesDataSet(DataProcessor.java:1516) at org.eclipse.birt.chart.internal.datafeed.DataProcessor.fillSeriesDataSet(DataProcessor.java:1485) at org.eclipse.birt.chart.internal.datafeed.DataProcessor.generateRuntimeSeries(DataProcessor.java:976) at org.eclipse.birt.chart.internal.datafeed.DataProcessor.generateRuntimeSeries(DataProcessor.java:721) at org.eclipse.birt.chart.factory.Generator.bindData(Generator.java:559) at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationImpl.onRowSets(ChartReportItemPresentationImpl.java:399) at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.processExtendedContent(LocalizedContentVisitor.java:651) at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.visitForeign(LocalizedContentVisitor.java:359) at org.eclipse.birt.report.engine.content.impl.ForeignContent.accept(ForeignContent.java:58) at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localize(LocalizedContentVisitor.java:111) at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:38) at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layoutChildren(HTMLPageLM.java:123) at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:81) at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:80) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:194) at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(Unknown Source) at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(Unknown Source) at org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(Unknown Source) at org.eclipse.birt.report.service.actionhandler.BirtRunAndRenderActionHandler.__execute(Unknown Source) at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(Unknown Source) at org.eclipse.birt.report.presentation.aggregation.layout.EngineFragment.doService(Unknown Source) at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(Unknown Source) at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(Unknown Source) at org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(EclipseErrorReportValve.java:153) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Unknown Source)

Files changed in fix:
chart/org.eclipse.birt.chart.reportitem/src/org/eclipse/birt/chart/reportitem/ChartReportItemGenerationImpl.java chart/org.eclipse.birt.chart.reportitem/src/org/eclipse/birt/chart/reportitem/ChartReportItemPresentationImpl.java