Skip to content

FOP-3354: A side float whose end falls inside a table ends after the table, not NoSuchElementException - #123

Open
plutext wants to merge 1 commit into
apache:mainfrom
plutext:FOP-3354
Open

plutext wants to merge 1 commit into
apache:mainfrom
plutext:FOP-3354

Conversation

@plutext

@plutext plutext commented Oct 6, 2026

Copy link
Copy Markdown

Fixes FOP-3354.

When a side float outlasts the paragraph it is anchored in and the content beside it continues into a table,
the float's end falls between two rows. PageBreaker.handleFloatLayout then reads the element list again from
that break, and TableLayoutManager cannot be restarted (isRestartable() is false): the table's child
iterator, already exhausted, threw NoSuchElementException in LMiter.next, and the document failed.

The change. PageBreakingAlgorithm.considerLegalBreak no longer takes a break between two boxes of the same
non-restartable layout manager as the float's edge; the edge waits for the first legal break after it. The rows
below the float keep the table's width, which the table set once for all its rows, so nothing is drawn
differently from a re-layout at the row, and the block after the table is laid out at full width.

Test. float_edge-inside-table.xml: a 40pt float in a 14pt heading with a 10pt space after it, then a
five-row table. It throws without the change. With it, the fop-core suite passes, 3679 tests and 0 failures, and
checkstyle reports 0 violations.

🤖 Generated with Claude Code

…table, not NoSuchElementException

When a side float outlasts the paragraph it is anchored in and the content beside it continues
into a table, the float's end falls between two rows. PageBreaker.handleFloatLayout then reads
the element list again from that break, and TableLayoutManager cannot be restarted
(isRestartable() is false): the table's child iterator, already exhausted, threw
NoSuchElementException in LMiter.next and the document failed.

PageBreakingAlgorithm.considerLegalBreak no longer takes a break between two boxes of the same
non-restartable layout manager as the float's edge; the edge waits for the first legal break
after it. The rows below the float keep the table's width, which the table set once for all its
rows, so nothing is drawn differently from a re-layout at the row, and the block after the table
is laid out at full width.

Test: float_edge-inside-table.xml, which threw NoSuchElementException before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant