Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-1564

NPE when having an empty <fo:inline>-element with hyphenation turned on

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 0.95
    • None
    • unqualified
    • None
    • Operating System: Windows XP
      Platform: PC
    • 45667

    Description

      I get a NullPointerException (see end of message) when transforming the following file with fop-0.95. (fop-0.94 can handle this).

      <?xml version="1.0" encoding="utf-8"?>
      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
      <fo:simple-page-master master-name="LetterPage" page-width="6in"
      page-height="3in">
      <fo:region-body region-name="PageBody" margin="0.7in"
      background-color="rgb(245,245,245)"/>
      </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="LetterPage" hyphenate="true">
      <fo:flow flow-name="PageBody">
      <fo:block font="12pt Arial">
      <!-- the following line causes a NullPointerException, if hyphenate is true -->
      <fo:inline id="document.general.efficiently.dictionary"/>
      <!-- the following line is working fine -->
      Some <fo:inline font-weight="bold" color="red">inline text</fo:inline> formatting.
      </fo:block>
      </fo:flow>
      </fo:page-sequence>
      </fo:root>

      It only happens when hyphenation is set to true and if the <fo:inline> element does not contain any text (I came across this while transforming a docbook <anchor> tag with the the docbook-xsl stylesheets).

      I mark this bug as "critical" because it stops us from migrating to fop-0.95 (at least as long as there is not workaround available).

      -----------------------------------
      java.lang.NullPointerException
      at org.apache.fop.layoutmgr.inline.InlineStackingLayoutManager.applyChanges(InlineStackingLayoutManager.java:350)
      at org.apache.fop.layoutmgr.inline.LineLayoutManager.findHyphenationPoints(LineLayoutManager.java:1480)
      at org.apache.fop.layoutmgr.inline.LineLayoutManager.findOptimalBreakingPoints(LineLayoutManager.java:950)
      at org.apache.fop.layoutmgr.inline.LineLayoutManager.createLineBreaks(LineLayoutManager.java:917)
      at org.apache.fop.layoutmgr.inline.LineLayoutManager.getNextKnuthElements(LineLayoutManager.java:607)
      at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:294)
      at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:116)
      at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:107)
      at org.apache.fop.layoutmgr.PageBreaker.getNextKnuthElements(PageBreaker.java:145)
      at org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:552)
      at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:137)
      at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:302)
      at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:264)
      at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:106)
      at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:234)
      at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:123)
      at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:340)
      at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:169)
      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:214)
      at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:125)
      at org.apache.fop.cli.Main.startFOP(Main.java:166)
      at org.apache.fop.cli.Main.main(Main.java:197)

      Attachments

        Activity

          People

            fop-dev@xmlgraphics.apache.org fop-dev
            mercuron Marco Soldati
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: