eclipse-birt / birt

Eclipse BIRT™ The open source reporting and data visualization project.
http://www.eclipse.org/birt
Eclipse Public License 2.0
456 stars 391 forks source link

Crash when rendering report #1797

Closed rbrooklyn closed 3 months ago

rbrooklyn commented 3 months ago

Hello.

We are currently using birt 4.10. When upgrading to 4.16, I am now getting crashes.

The stack is below. I'm unsure what is triggering it as it works fine with other reports tested so far. If I'm able to reliably recreate the crash I will attached a rptdesign file, for now I sadly cannot share the rptdesign file. I'm hoping the below is enough to help.

Jul 16, 2024 11:42:43 AM org.eclipse.birt.report.engine.api.impl.EngineTask handleFatalExceptions SEVERE: An error happened while running the report. Cause: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) at java.base/java.util.Objects.checkIndex(Objects.java:361) at java.base/java.util.ArrayList.get(ArrayList.java:427) at org.eclipse.birt.data.aggregation.impl.rank.BaseTotalRank$TotalRankAccumulator.calculateRank(BaseTotalRank.java:176) at org.eclipse.birt.data.aggregation.impl.rank.BaseTotalRank$TotalRankAccumulator.finish(BaseTotalRank.java:153) at org.eclipse.birt.data.engine.executor.aggregation.AggregationHelper.onRow(AggregationHelper.java:325) at org.eclipse.birt.data.engine.executor.aggregation.AggregationHelper.pass(AggregationHelper.java:178) at org.eclipse.birt.data.engine.executor.aggregation.AggregationHelper.calculate(AggregationHelper.java:147) at org.eclipse.birt.data.engine.executor.aggregation.AggregationHelper.populateAggregations(AggregationHelper.java:106) at org.eclipse.birt.data.engine.executor.aggregation.AggregationHelper.(AggregationHelper.java:86) at org.eclipse.birt.data.engine.executor.transform.pass.ResultSetProcessUtil.prepareAggregations(ResultSetProcessUtil.java:371) at org.eclipse.birt.data.engine.executor.transform.pass.ResultSetProcessUtil.populateResultSet(ResultSetProcessUtil.java:128) at org.eclipse.birt.data.engine.executor.transform.pass.ResultSetProcessUtil.doPopulate(ResultSetProcessUtil.java:85) at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.prepareQueryResultSet(PassManager.java:89) at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.pass(PassManager.java:106) at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.populateResultSet(PassManager.java:65) at org.eclipse.birt.data.engine.executor.transform.ResultSetPopulator.populateResultSet(ResultSetPopulator.java:205) at org.eclipse.birt.data.engine.executor.transform.CachedResultSet.(CachedResultSet.java:145) at org.eclipse.birt.data.engine.executor.dscache.DataSourceQuery.execute(DataSourceQuery.java:182) at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQueryExecutor.executeOdiQuery(PreparedOdaDSQuery.java:550) at org.eclipse.birt.data.engine.impl.QueryExecutor.execute(QueryExecutor.java:1076) at org.eclipse.birt.data.engine.impl.ServiceForQueryResults.executeQuery(ServiceForQueryResults.java:218) at org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(QueryResults.java:170) at org.eclipse.birt.report.engine.data.dte.QueryResultSet.(QueryResultSet.java:96) at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:150) at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:254) at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1624) at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:73) at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:60) at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:41) at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:45) at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.traverse(HTMLAbstractLM.java:358) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.traverse(HTMLAbstractLM.java:359) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.traverse(HTMLAbstractLM.java:359) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.traverse(HTMLAbstractLM.java:359) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.traverse(HTMLAbstractLM.java:359) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.traverse(HTMLAbstractLM.java:359) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.handleVisibility(HTMLAbstractLM.java:305) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:118) at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:66) at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92) at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:97) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:145) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:69)

speckyspooky commented 3 months ago

It seems to be that you use a rank()-calculation function of BIRT because the exception comes from "calculateRank()" which tries to sort your list, But your list hasn't any value and this case is not fetched. I changed this situation and it will be included with BIRT 4.17. But you can take a look into your report to find the rank-function and in the meantime you can replace it with a standard SQL-rank-method.

speckyspooky commented 3 months ago

The fix is merged to the master with PR #1798

rbrooklyn commented 3 months ago

Thank you for fixing this so quickly.