birt icon indicating copy to clipboard operation
birt copied to clipboard

Assert errors on Report Design parsing on Render task creation

Open NicolasPerritaz opened this issue 3 years ago • 0 comments

Hello,

We are facing various assert errors when we tests our reports with assertions enabled (ie -ea JVM flag) This is happening when we create a render task and the Birt Engine tries to open and parse the report design. The simplest way to reproduce the issue is to define a themes.rptlibrary with a custom theme defined (linked to a css file) and apply the theme to the report design. When testing the report with -ea flag set we get the following stack trace:

java.lang.AssertionError
	at org.eclipse.birt.report.model.parser.ReportElementState.checkContainer(ReportElementState.java:206)
	at org.eclipse.birt.report.model.parser.ReportElementState.addToSlot(ReportElementState.java:259)
	at org.eclipse.birt.report.model.parser.ReportElementState.initSimpleElement(ReportElementState.java:450)
	at org.eclipse.birt.report.model.parser.ReportElementState.initElement(ReportElementState.java:345)
	at org.eclipse.birt.report.model.parser.ThemeState.parseAttrs(ThemeState.java:87)
	at org.eclipse.birt.report.model.parser.ModuleParserHandler.startElement(ModuleParserHandler.java:261)
	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
	at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
	at org.eclipse.birt.report.model.parser.ModuleReader.readModule(ModuleReader.java:98)
	at org.eclipse.birt.report.model.parser.DesignReader.read(DesignReader.java:88)
	at org.eclipse.birt.report.model.core.DesignSessionImpl.openDesign(DesignSessionImpl.java:309)
	at org.eclipse.birt.report.model.api.SessionHandleImpl.openDesign(SessionHandleImpl.java:294)
	at org.eclipse.birt.report.model.api.SessionHandle.openDesign(SessionHandle.java:1)
	at org.eclipse.birt.report.engine.parser.ReportParser.getDesignHandle(ReportParser.java:158)
	at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.getReportDesignHandle(ReportEngineHelper.java:255)
	at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java:274)
	at org.eclipse.birt.report.engine.api.impl.ReportEngine.openReportDesign(ReportEngine.java:619)
	at org.eclipse.birt.report.engine.api.impl.ReportDocumentReader.loadReportRunnable(ReportDocumentReader.java:880)
	at org.eclipse.birt.report.engine.api.impl.ReportDocumentReader.getOnPreparedRunnable(ReportDocumentReader.java:937)
	at org.eclipse.birt.report.engine.api.impl.ReportDocumentReader.getOnPreparedRunnable(ReportDocumentReader.java:1)
	at org.eclipse.birt.report.engine.api.impl.EngineTask.getOnPreparedRunnable(EngineTask.java:263)
	at org.eclipse.birt.report.engine.api.impl.RenderTask.initRenderTask(RenderTask.java:149)
	at org.eclipse.birt.report.engine.api.impl.RenderTask.<init>(RenderTask.java:115)
	at org.eclipse.birt.report.engine.api.impl.RenderTask.<init>(RenderTask.java:98)
	at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.createRenderTask(ReportEngineHelper.java:502)
	at org.eclipse.birt.report.engine.api.impl.ReportEngine.createRenderTask(ReportEngine.java:518)

We noticed that the error doesn't happen if we pass the IReportRunnable of the report design to the IRenderTask.createRenderTask method. It seems that in this case the parsing is bypassed, but then the generated pdf contains many unexpected layout issues that may be caused by the fact that some dynamic design changes via the API are not applied.

When running the report without the IReportRunnable argument in the createRenderTask method, and without the -ea flag the report is generated correctly. However the fact that there are AssertionError thrown when runing with -ea flag indicates either a misuse/misconfiguration of the engine or a bug in the engine.

NicolasPerritaz avatar Oct 03 '22 10:10 NicolasPerritaz