CFDocument throws "AnonymousBlockBox cannot be cast to class TableCellBox" error on some HTML

Description

The following HTML passed into CFDocument

<cfdocument> <html> <body> <table> <tr> <td></td> <td style="float:right"></td> </tr> </table> </body> </html> </cfdocument>

throws the following error:

lucee.runtime.exp.NativeException: class org.xhtmlrenderer.render.AnonymousBlockBox cannot be cast to class org.xhtmlrenderer.newtable.TableCellBox (org.xhtmlrenderer.render.AnonymousBlockBox and org.xhtmlrenderer.newtable.TableCellBox are in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @47640d6e) at org.xhtmlrenderer.newtable.TableSectionBox.recalcCells(TableSectionBox.java:83) at org.xhtmlrenderer.newtable.TableBox.recalcSections(TableBox.java:204) at org.xhtmlrenderer.newtable.TableBox.calcMinMaxWidth(TableBox.java:154) at org.xhtmlrenderer.newtable.TableBox.layout(TableBox.java:221) at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321) at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299) at org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:90) at org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:978) at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:858) at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:787) at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321) at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299) at org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:90) at org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:978) at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:858) at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:787) at org.xhtmlrenderer.pdf.ITextRenderer.layout(ITextRenderer.java:229) at org.lucee.extension.pdf.xhtmlrenderer.FSPDFDocument.createPDF(FSPDFDocument.java:239) at org.lucee.extension.pdf.xhtmlrenderer.FSPDFDocument.content(FSPDFDocument.java:128) at org.lucee.extension.pdf.xhtmlrenderer.FSPDFDocument._render(FSPDFDocument.java:107) at org.lucee.extension.pdf.PDFDocument.render(PDFDocument.java:360) at org.lucee.extension.pdf.tag.Document.renderInital(Document.java:847) at org.lucee.extension.pdf.tag.Document._doAfterBody(Document.java:744) at org.lucee.extension.pdf.tag.Document.doAfterBody(Document.java:696) at users.brad._7ff64314_b2b9_49ab_9b57fa41647f0027_cfm1890$cf.call(/C_drive/Users/Brad/7FF64314-B2B9-49AB-9B57FA41647F0027.cfm:1) ... Caused by: java.lang.ClassCastException: class org.xhtmlrenderer.render.AnonymousBlockBox cannot be cast to class org.xhtmlrenderer.newtable.TableCellBox (org.xhtmlrenderer.render.AnonymousBlockBox and org.xhtmlrenderer.newtable.TableCellBox are in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @47640d6e)

This may be a bug in the underlying PDF engine, but I wanted to start here since it was a class casting error and could be related to our OSGI handling.

Environment

None

Activity

Show:

Pothys - MitrahSoft 1 November 2022 at 13:27

I've checked this ticket and confirmed the issue happened on the lucee version 5.3.10.87-SNAPSHOT and pdf extension version 1.1.0.16-SNAPSHOT. I replicated the issue with the above code, cfdocument throws an error like org.xhtmlrenderer.render.AnonymousBlockBox cannot be cast to org.xhtmlrenderer.newtable.TableCellBox and it works fine with the classic engine.

I added a testcase to this ticket
Pull Request: https://github.com/lucee/extension-pdf/pull/48

Zac Spitzer 1 November 2022 at 08:27

good digging tho we use a different repo https://github.com/flyingsaucerproject/flyingsaucer/search?q=ClassCastException&type=issues

those are all almost 10 years old?

Details

Assignee

Reporter

Priority

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Created 31 October 2022 at 17:55
Updated 11 November 2022 at 11:42

Flag notifications