diff options
author | Jeremias Maerki <jeremias@apache.org> | 2006-01-26 11:05:43 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2006-01-26 11:05:43 +0000 |
commit | 11d47a815eb1b9f4415a608657e00b88a0068be9 (patch) | |
tree | 99b07c385e87c82ca243f6e417d660ddc77aaa82 /src/java/org/apache | |
parent | 5c9f9e96d0d283994ceefe4e8ca8aaa6e711a88f (diff) | |
download | xmlgraphics-fop-11d47a815eb1b9f4415a608657e00b88a0068be9.tar.gz xmlgraphics-fop-11d47a815eb1b9f4415a608657e00b88a0068be9.zip |
Bugzilla #38397:
Bugfix: Spanned cells could lead to an false error message about overlapping cells and ultimately a NullPointerException.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@372504 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java b/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java index 0781d4ee6..72c285700 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java @@ -355,6 +355,9 @@ public class TableRowIterator { colnum++; } } + if (pendingRowSpans < 0) { + throw new IllegalStateException("pendingRowSpans must not become negative!"); + } //Transfer available cells to their slots colnum = 1; @@ -368,9 +371,15 @@ public class TableRowIterator { //shouldn't happen here, since //overlapping cells already caught in //fo.flow.TableCell.bind()... - if (safelyGetListItem(gridUnits, colnum - 1) != null) { - log.error("Overlapping cell at position " + colnum); - //TODO throw layout exception + GridUnit other = (GridUnit)safelyGetListItem(gridUnits, colnum - 1); + if (other != null) { + String err = "A table-cell (" + + cell.getContextInfo() + + ") is overlapping with another (" + + other.getCell().getContextInfo() + + ") in column " + colnum; + throw new IllegalStateException(err + + " (this should have been catched by FO tree validation)"); } TableColumn col = columns.getColumn(colnum); @@ -390,12 +399,20 @@ public class TableRowIterator { for (int j = 1; j < cell.getNumberColumnsSpanned(); j++) { colnum++; GridUnit guSpan = new GridUnit(gu, columns.getColumn(colnum), colnum - 1, j); - if (safelyGetListItem(gridUnits, colnum - 1) != null) { - log.error("Overlapping cell at position " + colnum); - //TODO throw layout exception + //TODO: remove the check below??? + other = (GridUnit)safelyGetListItem(gridUnits, colnum - 1); + if (other != null) { + String err = "A table-cell (" + + cell.getContextInfo() + + ") is overlapping with another (" + + other.getCell().getContextInfo() + + ") in column " + colnum; + throw new IllegalStateException(err + + " (this should have been catched by FO tree validation)"); } safelySetListItem(gridUnits, colnum - 1, guSpan); if (hasRowSpanningLeft) { + pendingRowSpans++; safelySetListItem(lastRowsSpanningCells, colnum - 1, gu); } horzSpan[j] = guSpan; |