Bug 45295 - Marker example (hide.fo) throws Null Pointer Exception for forward references
Summary: Marker example (hide.fo) throws Null Pointer Exception for forward references
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: 0.94
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-27 02:34 UTC by Jamie Browning
Modified: 2012-04-01 06:40 UTC (History)
0 users



Attachments
Use case demonstrating error (1.87 KB, text/plain)
2008-06-27 02:35 UTC, Jamie Browning
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jamie Browning 2008-06-27 02:34:31 UTC
In 0.94 and 0.95 beta the Marker example (hide.fo) throws the following Exception.

C:\Program Files\fop-0.94\examples\fo>ant runtest
Buildfile: build.xml

init:

newPDF:

newTestFiles:
      [fop] C:\Program Files\fop-0.94\examples\fo\markers\hide.fo -> C:\Program
Files\fop-0.94\examples\fo\tests\hide.pdf
      [fop] 27-Jun-2008 09:59:38 org.apache.fop.cli.InputHandler error
      [fop] SEVERE: javax.xml.transform.TransformerException:

BUILD FAILED
C:\Program Files\fop-0.94\examples\fo\build.xml:82: The following error occurred
 while executing this line:
C:\Program Files\fop-0.94\examples\fo\build.xml:48: javax.xml.transform.Transfor
merException: java.lang.NullPointerException:

Total time: 2 seconds

I have attached a sample file which more closely matches the use case that I discovered this issue from. This works fine in 0.25 but is broken in 0.94/0.95beta.

The stack trace from running this example on 0.94 is slightly more useful than the one from the example:

H:\My Documents\Catlin\IT\Development\FO Processor\run_fo>"C:\Program Files\fop-
0.94\fop.bat" -fo infile.fo -pdf outfile.pdf
27-Jun-2008 10:32:53 org.apache.fop.cli.Main startFOP
SEVERE: Exception
java.lang.NullPointerException:
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:168)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
        at org.apache.fop.cli.Main.startFOP(Main.java:166)
        at org.apache.fop.cli.Main.main(Main.java:197)

---------

java.lang.NullPointerException:
        at org.apache.fop.fo.flow.PageNumberCitation.startOfNode(PageNumberCitat
ion.java:115)
        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuil
der.java:329)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:185)
        at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(Tra
nsformerIdentityImpl.java:1072)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Sour
ce)
        at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unkn
own Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
own Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known 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.xalan.transformer.TransformerIdentityImpl.transform(Transf
ormerIdentityImpl.java:484)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:165)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
        at org.apache.fop.cli.Main.startFOP(Main.java:166)
        at org.apache.fop.cli.Main.main(Main.java:197)
Comment 1 Jamie Browning 2008-06-27 02:35:41 UTC
Created attachment 22186 [details]
Use case demonstrating error
Comment 2 Andreas L. Delmelle 2008-06-27 10:51:57 UTC
Already adding this note for completeness (already mentioned on fop-users@ yesterday)

The issue is partly fixed in FOP Trunk. page-number-citations in markers no longer throw an Exception, but there is still a remaining problem for the forward reference: in the example 'hide.fo', the retrieved marker shows 'page 2 of 1'.

Additionally, there appears to be a problem with with instream-foreign-object in markers. In the example 'hide.fo', the embedded SVG does not render at all (note: after changing stroke and fill to 'red' instead of 'white'... First wasted a lot of time wondering why I did not see any rectangle, then noticed it was a completely white one :-S )
Comment 3 Andreas L. Delmelle 2008-06-29 04:10:42 UTC
(In reply to comment #2)

> The issue is partly fixed in FOP Trunk. page-number-citations in markers no
> longer throw an Exception, but there is still a remaining problem for the
> forward reference: in the example 'hide.fo', the retrieved marker shows 'page 2
> of 1'.

Looking closer, the output does seem to be correct. The fo:marker in fo:block[@id='end-seq1'] still belongs to page 1. The second page is an empty page that is produced by the fact that the second page-sequence has an odd initial-page-number. Setting force-page-count to 'no-force' on the first, generates only one page.

So, the bug concerning forward-references is fixed in FOP Trunk now.
I have also added a disabled tescase for the remaining problem with instream-foreign-object.

see:
http://svn.apache.org/viewvc?rev=672010&view=rev
http://svn.apache.org/viewvc?rev=672496&view=rev
http://svn.apache.org/viewvc?rev=672617&view=rev

Thanks for reporting!
Comment 4 Glenn Adams 2012-04-01 06:40:57 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed