From: Luis Bernardo Date: Sun, 21 Oct 2012 19:19:38 +0000 (+0000) Subject: bugzilla #48063: patches 28912 and 29015; fixes infinite loop in footnotes code X-Git-Tag: fop-2_0~280 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3ba7c3902139413b0bb5a3c601d2c0688198d8c3;p=xmlgraphics-fop.git bugzilla #48063: patches 28912 and 29015; fixes infinite loop in footnotes code git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1400704 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java index 3d45812d8..47195f90f 100644 --- a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java +++ b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java @@ -886,8 +886,14 @@ class PageBreakingAlgorithm extends BreakingAlgorithm { // create pages containing the remaining footnote bodies while (insertedFootnotesLength < totalFootnotesLength) { final int tmpLength = lengthList.get(footnoteListIndex); + // check if last footnote has already been added completely + if (insertedFootnotesLength == tmpLength) { + footnoteListIndex++; + footnoteElementIndex + = getFootnoteList(footnoteListIndex).size() - 1; + } // try adding some more content - if ((tmpLength - insertedFootnotesLength) <= availableBPD) { + else if ((tmpLength - insertedFootnotesLength) <= availableBPD) { // add a whole footnote availableBPD -= tmpLength - insertedFootnotesLength; insertedFootnotesLength = tmpLength; diff --git a/test/layoutengine/standard-testcases/footnote-create_new_page.xml b/test/layoutengine/standard-testcases/footnote-create_new_page.xml new file mode 100644 index 000000000..9092f0d74 --- /dev/null +++ b/test/layoutengine/standard-testcases/footnote-create_new_page.xml @@ -0,0 +1,69 @@ + + + + + +

This test checks a footnote that requires a new page.

+
+ + + + + + + + + + + .... cities + + (1) + + 1. Lisbon, Chicago, London + + + , veggies + + (2) + + 2. Lettuce. + 2. Garlic. + 2. Potato. + + + , and fruits + + (3) + + 3. Apple, Coconut, Plum, Kiwi, Canteloupe, Tomato, + Clementine, Grapefruit, Guava, Quincy, Lemon, Blueberry, + Raspberry, Pomegranate, Watermelon, Orange, Cherry, Peach, + Banana, Mango, Pear, Melon, Apricot, Pineapple, Strawberry, + Persimon, Medlar. + + + + . + + + + + + + + + +
\ No newline at end of file