You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by bu...@apache.org on 2007/08/29 14:05:09 UTC

DO NOT REPLY [Bug 43237] New: - IndexOutOfBoundsException

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43237>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43237

           Summary: IndexOutOfBoundsException
           Product: Fop
           Version: 0.94
          Platform: All
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: general
        AssignedTo: fop-dev@xmlgraphics.apache.org
        ReportedBy: hussein@xmlmind.com
                CC: hussein@xmlmind.com


This IndexOutOfBoundsException:

===============================================================
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.RangeCheck(ArrayList.java:508)
        at java.util.ArrayList.get(ArrayList.java:320)
        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)
===============================================================

Workaround:

  In src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java, replace:

===============================================================
if (footnotesPending) {
    if (footnoteListIndex < footnotesList.size() - 1) {
        // add demerits for the deferred footnotes
        demerits += (footnotesList.size() - 1 - footnoteListIndex) 
                        * deferredFootnoteDemerits;
    }
    if (footnoteElementIndex 
            < ((LinkedList) footnotesList.get(footnoteListIndex)).size() - 1) {
        // add demerits for the footnote split between pages
        demerits += splitFootnoteDemerits;
    }
}
===============================================================
 
  by:

===============================================================
if (footnotesPending) {
    int footnotesListSize = footnotesList.size();
    if (footnoteListIndex < footnotesListSize - 1) {
        // add demerits for the deferred footnotes
        demerits += (footnotesListSize - 1 - footnoteListIndex) 
                        * deferredFootnoteDemerits;
    }
    if (footnoteListIndex < footnotesListSize &&
        footnoteElementIndex 
            < ((LinkedList) footnotesList.get(footnoteListIndex)).size() - 1) {
        // add demerits for the footnote split between pages
        demerits += splitFootnoteDemerits;
    }
}
===============================================================

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 43237] - IndexOutOfBoundsException

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43237>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43237


jmt4b04d4v@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmt4b04d4v@gmail.com




------- Additional Comments From jmt4b04d4v@gmail.com  2007-09-25 12:53 -------
Got into same issue, my scenario:
  * svn-book.fo (Subversion Book), FO file obtained with Xalan-J-2.7.0 (from
fop-0.94 distro), not xsltproc. Testcase candidate? (I tried to attach .fo file
without results)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 43237] - IndexOutOfBoundsException

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43237>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43237





------- Additional Comments From rainer.maximini@ser.de  2007-09-04 05:50 -------
I have exact the same problem here, but also only in a very large XSL-FO file.
The described workaround does not works correct because the first footnote is
always missing.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 43237] - IndexOutOfBoundsException

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43237>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43237





------- Additional Comments From LaslovD@spardat.at  2007-09-18 09:24 -------
I did an other workaround, that seems to work: I changed 

==========================================
    private void resetFootnotes(LinkedList elementLists) {
        for (int i = 0; i < elementLists.size(); i++) {
            LinkedList removedList = (LinkedList)
footnotesList.remove(footnotesList.size() - 1);
            lengthList.remove(lengthList.size() - 1);

            // update totalFootnotesLength
            if (lengthList.size() > 0) {
                totalFootnotesLength = ((Integer)
lengthList.get(lengthList.size() - 1)).intValue();
            } else {
                totalFootnotesLength = 0;
            }
        }
        // update footnotesPending;
        if (footnotesList.size() == 0) {
            footnotesPending = false;
        }
    }
=================================================

to 

=================================================
    private void resetFootnotes(LinkedList elementLists) {
        for (int i = 0; i < elementLists.size(); i++) {
            LinkedList removedList = (LinkedList)
footnotesList.remove(footnotesList.size() - 1);
            lengthList.remove(lengthList.size() - 1);

            // update totalFootnotesLength
            if (lengthList.size() > 0) {
                totalFootnotesLength = ((Integer)
lengthList.get(lengthList.size() - 1)).intValue();
            } else {
                totalFootnotesLength = 0;
            }
        }
        footnoteListIndex = footnotesList.size() - 1;
        // update footnotesPending;
        if (footnotesList.size() == 0) {
            footnotesPending = false;
        }
    }
=================================================

(difference is only adding one line)

BTW: my FO is very huge too (about 1.7 MB)


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 43237] - IndexOutOfBoundsException

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43237>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43237





------- Additional Comments From hussein@xmlmind.com  2007-08-30 09:04 -------
I'm really sorry but I don't have a short XSL-FO file which may be used to
easily reproduce this problem. I just have a large one, moreover full of
fo:external-graphic.

I presumed that by reading the code pinpointed by the stack trace, you could
guess   in which conditions such IndexOutOfBoundsException occurs.



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 43237] - IndexOutOfBoundsException

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43237>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43237





------- Additional Comments From vincent.hennebert@anyware-tech.com  2007-08-30 08:16 -------
Hi,

Can you please attach to this bug a short FO file showing the exception? It
might serve as a testcase.

Thanks,
Vincent

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.