Fop
  1. Fop
  2. FOP-1473

IndexOutOfBoundsException when creating pdf

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: trunk
    • Fix Version/s: None
    • Component/s: layout/unqualified
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: All
    • External issue ID:
      44160

      Description

      Hi,

      I create a FO-file from a pretty large docbook-xml (60 pages so far)
      with saxon (or xslt - doesn't matter) whith the docbook-xsl-1.71.1
      stylesheets.
      After that I use fop to convert it to pdf. I used 0.94 and the svn trunk
      version - with both I occasionally run into the error below.

      I was able to track the error down to the attached file
      (http://www.nabble.com/file/p14488145/tmp_sip.xml.fo).
      I tried to delete as much content as possible. If I delete any further paragraph
      of the text, the error doesn't occur any more. Also if I set hyphenation to true
      in my stylesheet, the error goes away.

      I tried it with fop 0.94 and trunk with the same result. For some reason fop
      0.92 doesn't show the error with that file, although it did before with other files.
      I hope that helps somehow to find the error.

      thanks Bjoern

      > 13.12.2007 13:27:30 org.apache.fop.cli.Main startFOP
      > SCHWERWIEGEND: Exception
      > java.lang.IndexOutOfBoundsException: Index: 4, Size: 1
      > 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.IndexOutOfBoundsException: Index: 4, Size: 1
      > at java.util.ArrayList.RangeCheck(ArrayList.java:546)
      > at java.util.ArrayList.get(ArrayList.java:321)
      > at
      org.apache.fop.layoutmgr.PageBreakingAlgorithm.computeDemerits(PageBreakingAlgorithm.java:644)
      > at
      org.apache.fop.layoutmgr.BreakingAlgorithm.considerLegalBreak(BreakingAlgorithm.java:737)
      > at
      org.apache.fop.layoutmgr.PageBreakingAlgorithm.considerLegalBreak(PageBreakingAlgorithm.java:309)
      > at
      org.apache.fop.layoutmgr.BreakingAlgorithm.findBreakingPoints(BreakingAlgorithm.java:485)
      > at
      org.apache.fop.layoutmgr.BreakingAlgorithm.findBreakingPoints(BreakingAlgorithm.java:403)
      > at
      org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:338)
      > at
      org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:263)
      > at
      org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:144)
      > at
      org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:233)
      > at
      org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:145)
      > at
      org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:378)
      > at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:194)
      > at
      org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1101)
      > at org.apache.xerces.parsers.AbstractSAXParser.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.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.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)

        Activity

        Hide
        Bjoern added a comment -

        Attachment tmp_sip.xml.fo has been added with description: Test file which causes the error

        Show
        Bjoern added a comment - Attachment tmp_sip.xml.fo has been added with description: Test file which causes the error
        Hide
        Jeremias Maerki added a comment -

        Cheap fix applied: http://svn.apache.org/viewvc?rev=614201&view=rev

        Not sure if it was the right thing to do but it didn't break anything but I
        haven't been able to come up with a scaled-down regression test, either. So I'll
        leave this open for now as a reminder. The whole thing has to do with footnotes.
        Note that the error cannot be reproduced if the test file here is pretty-printed.

        Show
        Jeremias Maerki added a comment - Cheap fix applied: http://svn.apache.org/viewvc?rev=614201&view=rev Not sure if it was the right thing to do but it didn't break anything but I haven't been able to come up with a scaled-down regression test, either. So I'll leave this open for now as a reminder. The whole thing has to do with footnotes. Note that the error cannot be reproduced if the test file here is pretty-printed.
        Hide
        Andreas L. Delmelle added a comment -

        Adding the comment here, since it was being referred to in the code:
        If I judge correctly, a more proper fix entails a change in PageBreakingAlgorithm.resetFootnotes(). Right now, it only alters the footnotesList and lengthList, but not the accompanying indices. That is only done in computeDifference().
        As such, it seems understandable that at some point, situations will arise where they are out of synch, and footnotesListIndex points to an element that was already removed.

        Show
        Andreas L. Delmelle added a comment - Adding the comment here, since it was being referred to in the code: If I judge correctly, a more proper fix entails a change in PageBreakingAlgorithm.resetFootnotes(). Right now, it only alters the footnotesList and lengthList, but not the accompanying indices. That is only done in computeDifference(). As such, it seems understandable that at some point, situations will arise where they are out of synch, and footnotesListIndex points to an element that was already removed.
        Hide
        Glenn Adams added a comment -

        unable to reproduce in trunk; marking fixed per JM comments below

        Show
        Glenn Adams added a comment - unable to reproduce in trunk; marking fixed per JM comments below

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development