Description
Greetings!
We're using openhtmltopdf in our project. Recently, we've updated from version 1.0.0 to 1.0.4, in order to solve a bug (reported in issue 420).
However, this upgrade caused another bug in our project. Now some documents break with the following stacktrace:
Caused by: java.lang.RuntimeException: set substring length too long (start = 1, end = 0): InlineText: ()
at com.openhtmltopdf.render.InlineText.setSubstring(InlineText.java:133)
at com.openhtmltopdf.layout.InlineBoxing.layoutText(InlineBoxing.java:1114)
at com.openhtmltopdf.layout.InlineBoxing.startInlineText(InlineBoxing.java:414)
at com.openhtmltopdf.layout.InlineBoxing.layoutContent(InlineBoxing.java:196)
at com.openhtmltopdf.render.BlockBox.layoutInlineChildren(BlockBox.java:1220)
at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1201)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
at com.openhtmltopdf.newtable.TableRowBox.layoutCell(TableRowBox.java:452)
at com.openhtmltopdf.newtable.TableRowBox.layoutChildren(TableRowBox.java:206)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
at com.openhtmltopdf.newtable.TableRowBox.layout(TableRowBox.java:95)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
at com.openhtmltopdf.newtable.TableSectionBox.layoutChildren(TableSectionBox.java:137)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
at com.openhtmltopdf.newtable.TableSectionBox.layout(TableSectionBox.java:278)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
at com.openhtmltopdf.newtable.TableBox.layoutChildren(TableBox.java:319)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
at com.openhtmltopdf.newtable.TableBox.layoutTable(TableBox.java:284)
at com.openhtmltopdf.newtable.TableBox.layout(TableBox.java:243)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
at com.openhtmltopdf.newtable.TableRowBox.layoutCell(TableRowBox.java:452)
at com.openhtmltopdf.newtable.TableRowBox.layoutChildren(TableRowBox.java:206)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
at com.openhtmltopdf.newtable.TableRowBox.layout(TableRowBox.java:95)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
at com.openhtmltopdf.newtable.TableSectionBox.layoutChildren(TableSectionBox.java:137)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
at com.openhtmltopdf.newtable.TableSectionBox.layout(TableSectionBox.java:278)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
at com.openhtmltopdf.newtable.TableBox.layoutChildren(TableBox.java:319)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
at com.openhtmltopdf.newtable.TableBox.layoutTable(TableBox.java:284)
at com.openhtmltopdf.newtable.TableBox.layout(TableBox.java:243)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild0(BlockBoxing.java:321)
at com.openhtmltopdf.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:299)
at com.openhtmltopdf.layout.BlockBoxing.layoutContent(BlockBoxing.java:90)
at com.openhtmltopdf.render.BlockBox.layoutChildren(BlockBox.java:1204)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:1058)
at com.openhtmltopdf.render.BlockBox.layout(BlockBox.java:973)
at com.openhtmltopdf.pdfboxout.PdfBoxRenderer.layout(PdfBoxRenderer.java:344)
at com.openhtmltopdf.pdfboxout.PdfRendererBuilder.run(PdfRendererBuilder.java:41)
... 208 more
After a few tests, we've reached two conclusions:
- The error didn't happen in versions 1.0.0 and 1.0.1. It occurs in all versions starting from 1.0.2;
- In our code, there's a base style which is appended in the documents:
body { word-wrap: break-word; font-family: 'Courier New', Courier, monospace; }
After removing the word-wrap style, it works again.
Is this an expected behaviour?
Cheers!