Stephen Hughes created FOP-2716: ----------------------------------- Summary: NPE when linefeed-treatment="preserve" and margins change Key: FOP-2716 URL: https://issues.apache.org/jira/browse/FOP-2716 Project: FOP Issue Type: Bug Affects Versions: 2.2 Reporter: Stephen Hughes Attachments: error.fo
A NullPointerException occurs 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. The exception can be reproduced with the attached file, running: fop.bat error.fo -pdf error.pdf Output is as follows: 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) -- This message was sent by Atlassian JIRA (v6.4.14#64029)