]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugzilla #44160:
authorJeremias Maerki <jeremias@apache.org>
Tue, 22 Jan 2008 14:02:27 +0000 (14:02 +0000)
committerJeremias Maerki <jeremias@apache.org>
Tue, 22 Jan 2008 14:02:27 +0000 (14:02 +0000)
Fixed a possible IndexOutOfBoundsException that could happen with certain constellations when footnotes are used. Note: I haven't been able to come up with a scaled-down testcase for regression testing. Maybe someone more intimate with the footnote handling can.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@614201 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
status.xml

index a9ef9fd13b376733495a77eda90f38d4956df840..32c2b8d3b33d0c61d853692ff17191febe8515a9 100644 (file)
@@ -25,11 +25,11 @@ import java.util.ListIterator;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.layoutmgr.AbstractBreaker.PageBreakPosition;
-
 import org.apache.fop.traits.MinOptMax;
 
 class PageBreakingAlgorithm extends BreakingAlgorithm {
@@ -641,10 +641,14 @@ class PageBreakingAlgorithm extends BreakingAlgorithm {
                 demerits += (footnotesList.size() - 1 - footnoteListIndex) 
                                 * deferredFootnoteDemerits;
             }
-            if (footnoteElementIndex 
-                    < ((LinkedList) footnotesList.get(footnoteListIndex)).size() - 1) {
-                // add demerits for the footnote split between pages
-                demerits += splitFootnoteDemerits;
+            if (footnoteListIndex < footnotesList.size()) {
+                if (footnoteElementIndex 
+                        < ((LinkedList) footnotesList.get(footnoteListIndex)).size() - 1) {
+                    // add demerits for the footnote split between pages
+                    demerits += splitFootnoteDemerits;
+                }
+            } else {
+                //TODO Why can this happen in the first place? Does anybody know? See #44160
             }
         }
         demerits += activeNode.totalDemerits;
index e866f3972b6119641c533bf60d53425847a0ff60..21c98c9ab55f1bd099f8ddd6e1cb901a73f10d4f 100644 (file)
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Layout" dev="JM" type="fix" fixes-bug="44160">
+        Fixed a possible IndexOutOfBoundsException that could happen with certain constellations
+        when footnotes are used.
+      </action>
       <action context="Layout" dev="JM" type="fix">
         Compliance fix: for absolutely positioned block-containers, "top" wasn't
         interpreted correctly.