Bug 532826 - ClassCastException with PDF emitter: org.eclipse.birt.report.engine.internal.content.wrap.CellContentWrapper cannot be cast to org.eclipse.birt.report.engine.content.impl.CellContent
Summary: ClassCastException with PDF emitter: org.eclipse.birt.report.engine.internal....
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 4.7.0   Edit
Hardware: PC Windows 10
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Birt-ReportEngine-inbox@eclipse.org CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-23 09:42 EDT by Henning von Bargen CLA
Modified: 2021-04-17 14:50 EDT (History)
4 users (show)

See Also:


Attachments
Minimal example demonstrating the bug (4.09 KB, application/xml)
2018-03-23 11:06 EDT, Henning von Bargen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Henning von Bargen CLA 2018-03-23 09:42:34 EDT
With very complex report, running the report with the PDF emitter from the Designer menu (Run/View Report/As PDF), the report fails with the following stack trace (see below).

The same report with the same input data works well with BIRT 4.2.1, 4.3.0 or 4.6.0.


-  org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report.
AxisFault

 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException

 faultSubcode: 

 faultString: org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report.

 faultActor: 

 faultNode: 

 faultDetail: 

	{http://xml.apache.org/axis/}stackTrace:org.eclipse.birt.report.service.api.ReportServiceException: Error happened 
...
Caused by: org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.

	at org.eclipse.birt.report.engine.api.impl.EngineTask.handleFatalExceptions(EngineTask.java:2379)

	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:191)

	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)

	at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:937)

	... 46 more

Caused by: java.lang.ClassCastException: org.eclipse.birt.report.engine.internal.content.wrap.CellContentWrapper cannot be cast to org.eclipse.birt.report.engine.content.impl.CellContent

	at org.eclipse.birt.report.engine.layout.LayoutUtil.getColWidthFromCellInFirstRow(LayoutUtil.java:120)

	at org.eclipse.birt.report.engine.nLayout.area.impl.TableArea$ColumnWidthResolver.resolveFixedLayout(TableArea.java:955)

	at org.eclipse.birt.report.engine.nLayout.area.impl.TableArea.resolveTableFixedLayout(TableArea.java:725)

	at org.eclipse.birt.report.engine.nLayout.area.impl.TableArea.initialize(TableArea.java:201)

	at org.eclipse.birt.report.engine.nLayout.LayoutEngine.setContainer(LayoutEngine.java:366)

	at org.eclipse.birt.report.engine.nLayout.LayoutEngine._startContainer(LayoutEngine.java:454)

	at org.eclipse.birt.report.engine.nLayout.LayoutEngine.startContainer(LayoutEngine.java:353)

	at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startTable(ContentEmitterAdapter.java:75)

	at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:50)

	at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitContent(LayoutEngine.java:713)

	at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitContent(LayoutEngine.java:721)

	at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitContent(LayoutEngine.java:721)

	at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitContent(LayoutEngine.java:721)

	at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitChildren(LayoutEngine.java:737)

	at org.eclipse.birt.report.engine.nLayout.RegionLayoutEngine.layout(RegionLayoutEngine.java:31)

	at org.eclipse.birt.report.engine.nLayout.area.impl.PageArea.layoutFooter(PageArea.java:489)

	at org.eclipse.birt.report.engine.nLayout.area.impl.PageArea.initialize(PageArea.java:249)

	at org.eclipse.birt.report.engine.nLayout.area.impl.RootArea.createNewPage(RootArea.java:154)

	at org.eclipse.birt.report.engine.nLayout.area.impl.RootArea.initialize(RootArea.java:145)

	at org.eclipse.birt.report.engine.nLayout.LayoutEngine.setContainer(LayoutEngine.java:366)

	at org.eclipse.birt.report.engine.nLayout.LayoutEngine._startContainer(LayoutEngine.java:454)

	at org.eclipse.birt.report.engine.nLayout.LayoutEngine.startContainer(LayoutEngine.java:353)

	at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startPage(ContentEmitterAdapter.java:65)

	at org.eclipse.birt.report.engine.emitter.CompositeContentEmitter.startPage(CompositeContentEmitter.java:290)

	at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:47)

	at org.eclipse.birt.report.engine.layout.html.buffer.PageNode.start(PageNode.java:49)

	at org.eclipse.birt.report.engine.layout.html.buffer.ContainerBufferNode.start(ContainerBufferNode.java:79)

	at org.eclipse.birt.report.engine.layout.html.buffer.ContainerBufferNode.start(ContainerBufferNode.java:79)

	at org.eclipse.birt.report.engine.layout.html.buffer.ContainerBufferNode.start(ContainerBufferNode.java:79)

	at org.eclipse.birt.report.engine.layout.html.buffer.HTMLPageBuffer.startContent(HTMLPageBuffer.java:113)

	at org.eclipse.birt.report.engine.layout.html.buffer.TableBreakBuffer.startContent(TableBreakBuffer.java:287)

	at org.eclipse.birt.report.engine.layout.html.HTMLLeafItemLM.start(HTMLLeafItemLM.java:67)

	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:139)

	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:71)

	at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)

	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)

	at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)

	at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)

	at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)

	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)

	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:71)

	at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)

	at org.eclipse.birt.report.engine.layout.html.HTMLRepeatHeaderLM.layoutChildren(HTMLRepeatHeaderLM.java:46)

	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)

	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:71)

	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:100)

	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:181)

	... 48 more

I ommited the rest.
Comment 1 Henning von Bargen CLA 2018-03-23 10:08:28 EDT
From the fact that this bug is new in 4.7.0 (the report worked in 4.6.0) it looks like the commits from Shijie Zhang from October 2016 (notably commit adc4b99fd12ce181df056e119d4b487a3971fced) are responsible for this error.
Comment 2 Henning von Bargen CLA 2018-03-23 10:26:39 EDT
I could track this down by removing layout elements from the report:

The problem is related to the following construction in the master page footer:

Simple Master Page - A4HochAuftragMasterPage
 Footer
  Grid - FooterGrid1
   Row
    Cell
     Grid - Fusstextbaustein1
      Row
       Cell
        Dynamic Text
       Cell
        Dynamic Text
      Row
       Cell
        Grid - NewGrid
         Row
          Cell 
           Data(DOC_ID)
          Cell
           Text
          Cell
           AutoText - Seite
           Text
           AutoText - AnzSeiten
         Row
          Cell
          Cell
          Cell
    Cell
     Image - Barcode_AuftID
    Cell
     Image - Akkredigierungslogo

If I hide the FooterGrid1 or the Fusstextbaustein1, the exception does not occur.
Comment 3 Henning von Bargen CLA 2018-03-23 10:43:44 EDT
It is also sufficient to hide only the first row of Fusstextbaustein1.
Note that the Master Page is referenced from a library and that the first cell of the Fusstextbaustein1 grid has rowspan=2. 
If I split the cell, the error does not occur.
Comment 4 Henning von Bargen CLA 2018-03-23 11:06:26 EDT
Created attachment 273275 [details]
Minimal example demonstrating the bug
Comment 5 Henning von Bargen CLA 2018-03-23 11:07:50 EDT
I could narrow it down further - see the attached rptdesign.
If you split the cell, it works.
Comment 6 Neimar Volpini CLA 2018-08-08 10:06:20 EDT
I've faced this error in a scenario where I had a grid in the header section of the master page and one of the grid columns had a "visibility" condition (The column should be hidden according to a report parameter value, for example).

After removing the visibility condition from the grid column, the error was gone. 

The report rendered correct in HTML/web viewer, the error happened for PDF output. Birt version 4.7.0.
Comment 7 Vincent Aurat CLA 2019-04-05 06:02:41 EDT
Same issue as Henning in birt 4.8 embedded in a java application.
(and same workaround as his also : splitting the rowspan Cell that is in a footer)

java.lang.ClassCastException: org.eclipse.birt.report.engine.internal.content.wrap.CellContentWrapper cannot be cast to org.eclipse.birt.report.engine.content.impl.CellContent
        at org.eclipse.birt.report.engine.layout.LayoutUtil.getColWidthFromCellInFirstRow(LayoutUtil.java:120)
        at org.eclipse.birt.report.engine.nLayout.area.impl.TableArea$ColumnWidthResolver.resolveFixedLayout(TableArea.java:955)
        at org.eclipse.birt.report.engine.nLayout.area.impl.TableArea.resolveTableFixedLayout(TableArea.java:725)
        at org.eclipse.birt.report.engine.nLayout.area.impl.TableArea.initialize(TableArea.java:201)
        at org.eclipse.birt.report.engine.nLayout.LayoutEngine.setContainer(LayoutEngine.java:366)
        at org.eclipse.birt.report.engine.nLayout.LayoutEngine._startContainer(LayoutEngine.java:454)
        at org.eclipse.birt.report.engine.nLayout.LayoutEngine.startContainer(LayoutEngine.java:353)
        at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startTable(ContentEmitterAdapter.java:75)
        at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:50)
        at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitContent(LayoutEngine.java:713)
        at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitContent(LayoutEngine.java:721)
        at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitContent(LayoutEngine.java:721)
        at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitContent(LayoutEngine.java:721)
        at org.eclipse.birt.report.engine.nLayout.LayoutEngine.visitChildren(LayoutEngine.java:737)
        at org.eclipse.birt.report.engine.nLayout.RegionLayoutEngine.layout(RegionLayoutEngine.java:31)
        at org.eclipse.birt.report.engine.nLayout.area.impl.PageArea.layoutHeader(PageArea.java:457)
        at org.eclipse.birt.report.engine.nLayout.area.impl.PageArea.initialize(PageArea.java:248)
        at org.eclipse.birt.report.engine.nLayout.area.impl.RootArea.createNewPage(RootArea.java:154)
        at org.eclipse.birt.report.engine.nLayout.area.impl.RootArea.initialize(RootArea.java:145)
        at org.eclipse.birt.report.engine.nLayout.LayoutEngine.setContainer(LayoutEngine.java:366)
        at org.eclipse.birt.report.engine.nLayout.LayoutEngine._startContainer(LayoutEngine.java:454)
        at org.eclipse.birt.report.engine.nLayout.LayoutEngine.startContainer(LayoutEngine.java:353)
        at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startPage(ContentEmitterAdapter.java:65)
        at org.eclipse.birt.report.engine.emitter.CompositeContentEmitter.startPage(CompositeContentEmitter.java:290)
        at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:47)
        at org.eclipse.birt.report.engine.layout.html.buffer.PageNode.start(PageNode.java:49)
        at org.eclipse.birt.report.engine.layout.html.buffer.ContainerBufferNode.start(ContainerBufferNode.java:79)
        at org.eclipse.birt.report.engine.layout.html.buffer.ContainerBufferNode.start(ContainerBufferNode.java:79)
        at org.eclipse.birt.report.engine.layout.html.buffer.ContainerBufferNode.flush(ContainerBufferNode.java:48)
        at org.eclipse.birt.report.engine.layout.html.buffer.HTMLPageBuffer.endRow(HTMLPageBuffer.java:209)
        at org.eclipse.birt.report.engine.layout.html.buffer.HTMLPageBuffer.endContainer(HTMLPageBuffer.java:140)
        at org.eclipse.birt.report.engine.layout.html.buffer.TableBreakBuffer.endContainer(TableBreakBuffer.java:360)
        at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.end(HTMLStackingLM.java:42)
        at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:141)
        at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:71)
        at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
        at org.eclipse.birt.report.engine.layout.html.HTMLRepeatHeaderLM.layoutChildren(HTMLRepeatHeaderLM.java:46)
        at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
        at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:71)
        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:100)
        at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:181)
        at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
Comment 8 Juan Pablo Garcia CLA 2021-04-17 14:50:42 EDT
I faced the same isue today, it is when you have in the master one merged cell, a temporary workarround to solve this is to add an empty row in ther first row of the header grid.