Bug 53817 - FOP throws NPE if a foot-note is declared within a static-region
Summary: FOP throws NPE if a foot-note is declared within a static-region
Status: REOPENED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: pdf (show other bugs)
Version: 1.0
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-02 15:36 UTC by Mathieu Malaterre
Modified: 2012-10-03 07:08 UTC (History)
1 user (show)



Attachments
generated fo file (35.23 KB, text/x-xslfo)
2012-09-02 15:36 UTC, Mathieu Malaterre
Details
Minimal test case (846 bytes, text/x-xslfo)
2012-09-03 08:15 UTC, Pascal Sancho
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Malaterre 2012-09-02 15:36:14 UTC
Created attachment 29317 [details]
generated fo file

Hi,

I cannot process the following dobbook slides:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE slides PUBLIC "-//Norman Walsh//DTD Slides XML V3.4.0//EN" "http://docbook.sourceforge.net/release/slides/3.4.0/schema/dtd/slides-full.dtd">
<slides>
  <foil>
  <title>My Title<footnote><para><ulink url="http://www.example.com/"/></para></footnote></title>
  <para/>
  </foil>
</slides>


it keeps on failing with:

$ xsltproc -o t.fo /usr/share/xml/docbook/custom/slides/3.4.0/xsl/fo/plain.xsl s.xml
$ fop t.fo t.pdf 
Image not found. URI: images/draft.png. (See position 2:9711)
Image not found. URI: images/draft.png. (See position 2:10376)
Image not found. URI: images/draft.png. (See position 2:11039)
Image not found. URI: images/draft.png. (See position 2:11699)
Image not found. URI: images/draft.png. (See position 2:12356)
Image not found. URI: images/draft.png. (See position 2:13013)
Image not found. URI: images/draft.png. (See position 2:13667)
Image not found. URI: images/draft.png. (See position 2:14326)
Image not found. URI: images/draft.png. (See position 2:14985)
Image not found. URI: images/draft.png. (See position 2:15641)
Image not found. URI: images/draft.png. (See position 2:16299)
Image not found. URI: images/draft.png. (See position 2:16957)
Image not found. URI: images/draft.png. (See position 2:17612)
Image not found. URI: images/draft.png. (See position 2:18270)
Image not found. URI: images/draft.png. (See position 2:18928)
Image not found. URI: images/draft.png. (See position 2:19583)
Image not found. URI: images/draft.png. (See position 2:20242)
Image not found. URI: images/draft.png. (See position 2:20901)
Image not found. URI: images/draft.png. (See position 2:21557)
Exception
java.lang.NullPointerException
Comment 1 Glenn Adams 2012-09-03 00:09:59 UTC
just verified this on dev trunk, the full backtrace is


java.lang.NullPointerException
        at org.apache.fop.layoutmgr.PageBreakingAlgorithm.handleFootnotes(PageBreakingAlgorithm.java:370)
        at org.apache.fop.layoutmgr.PageBreakingAlgorithm.handleBox(PageBreakingAlgorithm.java:319)
        at org.apache.fop.layoutmgr.BreakingAlgorithm.handleElementAt(BreakingAlgorithm.java:751)
        at org.apache.fop.layoutmgr.BreakingAlgorithm.findBreakingPoints(BreakingAlgorithm.java:554)
        at org.apache.fop.layoutmgr.BreakingAlgorithm.findBreakingPoints(BreakingAlgorithm.java:503)
        at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:421)
        at org.apache.fop.layoutmgr.StaticContentLayoutManager.doLayout(StaticContentLayoutManager.java:144)
        at org.apache.fop.layoutmgr.PageSequenceLayoutManager.layoutSideRegion(PageSequenceLayoutManager.java:180)
        at org.apache.fop.layoutmgr.PageSequenceLayoutManager.finishPage(PageSequenceLayoutManager.java:186)
        at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:115)
        at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:267)
        at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:128)
        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:347)
        at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:181)
        at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1101)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
        at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:285)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
        at org.apache.fop.cli.Main.startFOP(Main.java:177)
        at org.apache.fop.cli.Main.main(Main.java:208)
Comment 2 Glenn Adams 2012-09-03 00:19:10 UTC
looks like this code was last modified by Andreas in

http://svn.apache.org/viewvc?view=revision&revision=1067762

Andreas would you have time to take a look at this?
Comment 3 Pascal Sancho 2012-09-03 08:15:12 UTC
Created attachment 29318 [details]
Minimal test case

The NPE is thrown when foot-note is declared within the static-before region.
If I move the foot-note to the body, the NPE disappears.

Note that FOP behaves in the same way whatever the version is (tried against v0.95, v1.0, latest trunk).

That said, IMHO I don't think that a static region is the right place for a footnote declaration, so author should avoid to use that at this place, as a good practice/workaround.
Comment 4 Mathieu Malaterre 2012-10-02 15:48:16 UTC
As per comment on:

https://lists.oasis-open.org/archives/docbook-apps/201209/msg00062.html

This is a bug in the original fo generator (docbook). Closing issue as fixed.
Comment 5 Pascal Sancho 2012-10-03 07:08:16 UTC
FOP should throw/warn a more explicit Exception/message than throwing NPE in this case.
So, I reopen it as a reminder.