https://issues.apache.org/bugzilla/show_bug.cgi?id=48063

--- Comment #14 from Matthias Reischenbacher <matthias8...@gmx.at> ---
(In reply to comment #12)
> (In reply to comment #11)
> > Created attachment 28911 [details]
> > Minimal test case
> 
> The problem is occurring in PageBreakingAlgorithm#createFootnotePages
> 
> // create pages containing the remaining footnote bodies                    
> 
> while (insertedFootnotesLength < totalFootnotesLength) {
>     final int tmpLength = lengthList.get(footnoteListIndex);
>     // try adding some more content                                         
> 
>     if ((tmpLength - insertedFootnotesLength) <= availableBPD) {
>         // add a whole footnote                                             
> 
>         availableBPD -= tmpLength - insertedFootnotesLength;
>         insertedFootnotesLength = tmpLength;
>         footnoteElementIndex
>             = getFootnoteList(footnoteListIndex).size() - 1;
>     } else {
>         ...
>     }
> }
> 
> if tmpLength == insertedFootnotesLength, then the loop doesn't terminate
> [even if availableBPD is zero]; clearly this logic is broken, but I don't
> have enough familiarity with this code to effect a quick fix without further
> study

tmpLength == insertedFootnotesLength means that the current footnote has
already been added and no additional footnote page has to be created (at least
for the current footnote). So increasing the footnoteListIndex (as suggested in
#48162) seems correct to me. I'm wondering why it isn't correctly set in the
first place, getFootnoteSplit() seems to have something to do with that.
Perhaps a proper fix would be necessary there.
I'm attaching a patch anyway, because it solves the problem without breaking
something else (at least according to the junit layout tests).

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to