- Code: Select all
Caused by: java.lang.NullPointerException
at org.docx4j.org.xhtmlrenderer.layout.BoxBuilder.createChildren(BoxBuilder.java:205)
at org.docx4j.org.xhtmlrenderer.layout.BoxBuilder.createChildren(BoxBuilder.java:312)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.ensureChildren(BlockBox.java:919)
at org.docx4j.org.xhtmlrenderer.layout.BoxBuilder.createChildren(BoxBuilder.java:173)
at org.docx4j.org.xhtmlrenderer.layout.BoxBuilder.createChildren(BoxBuilder.java:312)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.ensureChildren(BlockBox.java:919)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.isVerticalMarginsAdjoin(BlockBox.java:1260)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.collapseMargins(BlockBox.java:1087)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:780)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:735)
at org.docx4j.org.xhtmlrenderer.docx.DocxRenderer.layout(DocxRenderer.java:187)
at org.docx4j.convert.in.xhtml.XHTMLImporter.convert(XHTMLImporter.java:413)
....
The problem is the statement
- Code: Select all
parent.getLocalName().equals("script")
is not null-safe, it should be the opposite:
- Code: Select all
"script".equals(parent.getLocalName())
By the way i guess this is hiding a more insidious library issue.
At runtime
- Code: Select all
parent.getLocalName()