fop 2.2 NullPointerException when linefeed-treatment="preserve" and margins change

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

fop 2.2 NullPointerException when linefeed-treatment="preserve" and margins change

HUGHES Stephen (ATS)

Hi all,

 

I have encountered a NullPointerException when rendering an fo to pdf using fop-2.2 on Windows 7 64-bit with JDK 1.8.0_74.  I've attached a simple FO file that  reproduces the exception.  The command line I'm running is simply:

    fop.bat error.fo -pdf error.pdf

 

Output (with stack trace) is below.

 

The exception seems to occur when fop encounters a block with linefeed-treatment="preserve" and a linefeed occurs at a page boundary where the left and/or right margins change.  In the attached example, if I remove the block's linefeed-treatment="preserve" attribute, or set margin-right="20mm" for page_rest (so it's the same as page_first), the exception does not occur.  I’ve also found that replacing the linefeed between the 3s and 4s with a space prevents the exception, but the line of 1s is reprinted at the top of the second page.

 

Thanks,

Stephen

 

Jun 16, 2017 8:45:33 AM org.apache.fop.cli.Main startFOP

SEVERE: Exception

org.apache.fop.apps.FOPException

java.lang.NullPointerException

        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:296)

        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:116)

        at org.apache.fop.cli.Main.startFOP(Main.java:186)

        at org.apache.fop.cli.Main.main(Main.java:217)

Caused by: java.lang.NullPointerException

        at org.apache.fop.layoutmgr.AbstractBreaker.getRestartAtLM(AbstractBreaker.java:529)

        at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:436)

        at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:112)

        at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:141)

        at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:267)

        at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:130)

        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:360)

        at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:190)

        at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1102)

        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:485)

        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:293)

        ... 3 more

 

---------

 

java.lang.NullPointerException

        at org.apache.fop.layoutmgr.AbstractBreaker.getRestartAtLM(AbstractBreaker.java:529)

        at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:436)

        at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:112)

        at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:141)

        at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:267)

        at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:130)

        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:360)

        at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:190)

        at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1102)

        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:485)

        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:293)

        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:116)

        at org.apache.fop.cli.Main.startFOP(Main.java:186)

        at org.apache.fop.cli.Main.main(Main.java:217)

 

 

------------------------------
The information in this email together with any attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. There is no waiver of any confidentiality/privilege by your inadvertent receipt of this material.
Any form of review, disclosure, modification, distribution and/or publication of this email message is prohibited, unless as a necessary part of Departmental business.
If you have received this message in error, you are asked to inform the sender as quickly as possible and delete this message and any copies of this message from your computer and/or your computer system network.
------------------------------

error.fo (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: fop 2.2 NullPointerException when linefeed-treatment="preserve" and margins change

Chris Bowditch
Hi Stephen,

XSL-FO with changing IPDs between pages is known to have a few bugs.
Please log a bug in JIRA making sure to attach the XSL-FO File that
replicates the NPE.

Thanks,

Chris

On 16/06/2017 01:12, HUGHES Stephen (ATS) wrote:

>
> Hi all,
>
> I have encountered a NullPointerException when rendering an fo to pdf
> using fop-2.2 on Windows 7 64-bit with JDK 1.8.0_74.  I've attached a
> simple FO file that  reproduces the exception.  The command line I'm
> running is simply:
>
>     fop.bat error.fo -pdf error.pdf
>
> Output (with stack trace) is below.
>
> The exception seems to occur when fop encounters a block with
> linefeed-treatment="preserve" and a linefeed occurs at a page boundary
> where the left and/or right margins change.  In the attached example,
> if I remove the block's linefeed-treatment="preserve" attribute, or
> set margin-right="20mm" for page_rest (so it's the same as
> page_first), the exception does not occur.  I’ve also found that
> replacing the linefeed between the 3s and 4s with a space prevents the
> exception, but the line of 1s is reprinted at the top of the second page.
>
> Thanks,
>
> Stephen
>
> Jun 16, 2017 8:45:33 AM org.apache.fop.cli.Main startFOP
>
> SEVERE: Exception
>
> org.apache.fop.apps.FOPException
>
> java.lang.NullPointerException
>
>         at
> org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:296)
>
>         at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:116)
>
>         at org.apache.fop.cli.Main.startFOP(Main.java:186)
>
>         at org.apache.fop.cli.Main.main(Main.java:217)
>
> Caused by: java.lang.NullPointerException
>
>         at
> org.apache.fop.layoutmgr.AbstractBreaker.getRestartAtLM(AbstractBreaker.java:529)
>
>         at
> org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:436)
>
>         at
> org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:112)
>
>         at
> org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:141)
>
>         at
> org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:267)
>
>         at
> org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:130)
>
>         at
> org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:360)
>
>         at
> org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:190)
>
>         at
> org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1102)
>
>         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:485)
>
>         at
> org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:293)
>
>         ... 3 more
>
> ---------
>
> java.lang.NullPointerException
>
>         at
> org.apache.fop.layoutmgr.AbstractBreaker.getRestartAtLM(AbstractBreaker.java:529)
>
>         at
> org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:436)
>
>         at
> org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:112)
>
>         at
> org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:141)
>
>         at
> org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:267)
>
>         at
> org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:130)
>
>         at
> org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:360)
>
>         at
> org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:190)
>
>         at
> org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1102)
>
>         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:485)
>
>         at
> org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:293)
>
>         at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:116)
>
>         at org.apache.fop.cli.Main.startFOP(Main.java:186)
>
>         at org.apache.fop.cli.Main.main(Main.java:217)
>
> ------------------------------
> The information in this email together with any attachments is
> intended only for the person or entity to which it is addressed and
> may contain confidential and/or privileged material. There is no
> waiver of any confidentiality/privilege by your inadvertent receipt of
> this material.
> Any form of review, disclosure, modification, distribution and/or
> publication of this email message is prohibited, unless as a necessary
> part of Departmental business.
> If you have received this message in error, you are asked to inform
> the sender as quickly as possible and delete this message and any
> copies of this message from your computer and/or your computer system
> network.
> ------------------------------