Fop
  1. Fop
  2. FOP-1549

Marker example (hide.fo) throws Null Pointer Exception for forward references

    Details

    • Type: Bug Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 0.94
    • Fix Version/s: None
    • Component/s: general
    • Labels:
      None
    • Environment:
      Operating System: Windows XP
      Platform: PC
    • External issue ID:
      45295

      Description

      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)

      1. infile.fo
        2 kB
        Jamie Browning

        Activity

        Hide
        Glenn Adams added a comment -

        batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed

        Show
        Glenn Adams added a comment - batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed
        Hide
        Andreas L. Delmelle added a comment -

        (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!

        Show
        Andreas L. Delmelle added a comment - (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!
        Hide
        Andreas L. Delmelle added a comment -

        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 )

        Show
        Andreas L. Delmelle added a comment - 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 )
        Hide
        Jamie Browning added a comment -

        Attachment infile.fo has been added with description: Use case demonstrating error

        Show
        Jamie Browning added a comment - Attachment infile.fo has been added with description: Use case demonstrating error

          People

          • Assignee:
            fop-dev
            Reporter:
            Jamie Browning
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development