MaikJaek/flying-saucer

Getting NullPointerException while generating PDF from HTML

Opened this issue · 1 comments

What steps will reproduce the problem?
1. Use the Attached HTML (generated on the fly) to create PDF
2. Getting a NullPointerException
3.

What is the expected output? What do you see instead?
A PDF but getting the below Exception:-
java.lang.NullPointerException
    at org.xhtmlrenderer.newtable.TableRowBox.reset(TableRowBox.java:452)
    at org.xhtmlrenderer.render.LineBox.reset(LineBox.java:387)
    at org.xhtmlrenderer.render.Box.resetChildren(Box.java:558)
    at org.xhtmlrenderer.render.Box.reset(Box.java:511)
    at org.xhtmlrenderer.render.BlockBox.reset(BlockBox.java:540)
    at org.xhtmlrenderer.newtable.TableSectionBox.reset(TableSectionBox.java:186)
    at org.xhtmlrenderer.render.Box.resetChildren(Box.java:558)
    at org.xhtmlrenderer.render.Box.reset(Box.java:511)
    at org.xhtmlrenderer.render.BlockBox.reset(BlockBox.java:540)
    at org.xhtmlrenderer.newtable.TableBox.reset(TableBox.java:592)
    at org.xhtmlrenderer.render.Box.resetChildren(Box.java:558)
    at org.xhtmlrenderer.render.Box.reset(Box.java:511)
    at org.xhtmlrenderer.render.BlockBox.reset(BlockBox.java:540)
    at org.xhtmlrenderer.render.Box.resetChildren(Box.java:558)
    at org.xhtmlrenderer.render.Box.reset(Box.java:511)
    at org.xhtmlrenderer.render.BlockBox.reset(BlockBox.java:540)
    at org.xhtmlrenderer.render.Box.resetChildren(Box.java:558)
    at org.xhtmlrenderer.render.Box.reset(Box.java:511)
    at org.xhtmlrenderer.render.BlockBox.reset(BlockBox.java:540)
    at org.xhtmlrenderer.render.Box.resetChildren(Box.java:558)
    at org.xhtmlrenderer.render.Box.reset(Box.java:511)
    at org.xhtmlrenderer.render.BlockBox.reset(BlockBox.java:540)
    at org.xhtmlrenderer.render.Box.resetChildren(Box.java:558)
    at org.xhtmlrenderer.render.Box.reset(Box.java:511)
    at org.xhtmlrenderer.render.BlockBox.reset(BlockBox.java:540)
    at org.xhtmlrenderer.render.Box.resetChildren(Box.java:558)
    at org.xhtmlrenderer.render.Box.reset(Box.java:511)
    at org.xhtmlrenderer.render.BlockBox.reset(BlockBox.java:540)
    at org.xhtmlrenderer.layout.LayoutUtil.positionFloatOnPage(LayoutUtil.java:126)
    at org.xhtmlrenderer.layout.LayoutUtil.layoutFloated(LayoutUtil.java:90)
    at org.xhtmlrenderer.layout.InlineBoxing.processOutOfFlowContent(InlineBoxing.java:837)
    at org.xhtmlrenderer.layout.InlineBoxing.layoutContent(InlineBoxing.java:289)
    at org.xhtmlrenderer.render.BlockBox.layoutInlineChildren(BlockBox.java:930)
    at org.xhtmlrenderer.render.AnonymousBlockBox.layout(AnonymousBlockBox.java:47)
    at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:255)
    at org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:82)
    at org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:914)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:794)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:723)
    at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:255)
    at org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:82)
    at org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:914)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:794)
    at org.xhtmlrenderer.newtable.TableRowBox.layoutCell(TableRowBox.java:419)
    at org.xhtmlrenderer.newtable.TableRowBox.layoutChildren(TableRowBox.java:202)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:794)
    at org.xhtmlrenderer.newtable.TableRowBox.layout(TableRowBox.java:88)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:723)
    at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:255)
    at org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:82)
    at org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:914)
    at org.xhtmlrenderer.newtable.TableSectionBox.layoutChildren(TableSectionBox.java:136)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:794)
    at org.xhtmlrenderer.newtable.TableSectionBox.layout(TableSectionBox.java:274)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:723)
    at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:255)
    at org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:82)
    at org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:914)
    at org.xhtmlrenderer.newtable.TableBox.layoutChildren(TableBox.java:283)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:794)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:723)
    at org.xhtmlrenderer.newtable.TableBox.layoutTable(TableBox.java:249)
    at org.xhtmlrenderer.newtable.TableBox.layout(TableBox.java:227)
    at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:255)
    at org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:82)
    at org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:914)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:794)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:723)
    at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:255)
    at org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:82)
    at org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:914)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:794)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:723)
    at org.xhtmlrenderer.layout.BlockBoxing.layoutBlockChild(BlockBoxing.java:255)
    at org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:82)
    at org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:914)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:794)
    at org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:723)
    at org.xhtmlrenderer.pdf.ITextRenderer.layout(ITextRenderer.java:154)

What version of the product are you using? On what operating system?
Jars are 
  de.huxhorn.lilith.3rdparty.flyingsaucer.core-renderer-8Pre2.jar
  htmlcleaner-2.2.jar

Running on windows XP

Please provide any additional information below.

The table generated by YUI is causing the problem I'm sure because if I remove 
all the contents of the div <div class="box_bd"> line 362 in attached html the 
PDF is generated fine.

Need urgent help.
Thanks in advance!!
Sayantan

Original issue reported on code.google.com by babusona...@gmail.com on 25 May 2012 at 4:31

Attachments:

Ok found & resolved the issue. There was a problem with the HTML where an extra 
thead tag was generated  by YUI to handle column sorting

Original comment by babusona...@gmail.com on 25 May 2012 at 7:21