From d45049750af6e120424ced7aa7a057cc1540f535 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Tue, 25 May 2021 09:08:58 +0000 Subject: FOP-3014: ConcurrentModificationException for table cell git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1890190 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/layoutmgr/inline/TextLayoutManager.java | 10 ++++++---- .../main/java/org/apache/fop/layoutmgr/table/ActiveCell.java | 10 ++++------ .../org/apache/fop/layoutmgr/table/TableCellLayoutManager.java | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'fop-core') diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java index 476860704..57f790912 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java @@ -436,10 +436,12 @@ public class TextLayoutManager extends LeafNodeLayoutManager { } private void setBlockProgressionOffset() { - if (blockProgressionDimension == alignmentContext.getHeight()) { - textArea.setBlockProgressionOffset(0); - } else { - textArea.setBlockProgressionOffset(alignmentContext.getOffset()); + if (alignmentContext != null) { + if (blockProgressionDimension == alignmentContext.getHeight()) { + textArea.setBlockProgressionOffset(0); + } else { + textArea.setBlockProgressionOffset(alignmentContext.getOffset()); + } } } diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/ActiveCell.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/ActiveCell.java index 81841b246..668bd9c19 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/ActiveCell.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/ActiveCell.java @@ -239,25 +239,23 @@ class ActiveCell { private void handleExplicitHeight(MinOptMax cellBPD, MinOptMax rowBPD) { int minBPD = Math.max(cellBPD.getMin(), rowBPD.getMin()); if (minBPD > 0) { - ListIterator iter = elementList.listIterator(); int cumulateLength = 0; boolean prevIsBox = false; - while (iter.hasNext() && cumulateLength < minBPD) { - KnuthElement el = (KnuthElement) iter.next(); + for (int i = 0; i < elementList.size() && cumulateLength < minBPD; i++) { + KnuthElement el = (KnuthElement) elementList.get(i); if (el.isBox()) { prevIsBox = true; cumulateLength += el.getWidth(); } else if (el.isGlue()) { if (prevIsBox) { - elementList.add(iter.nextIndex() - 1, - new FillerPenalty(minBPD - cumulateLength)); + elementList.add(i, new FillerPenalty(minBPD - cumulateLength)); } prevIsBox = false; cumulateLength += el.getWidth(); } else { prevIsBox = false; if (cumulateLength + el.getWidth() < minBPD) { - iter.set(new FillerPenalty((KnuthPenalty) el, minBPD - cumulateLength)); + elementList.set(i, new FillerPenalty((KnuthPenalty) el, minBPD - cumulateLength)); } } } diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java index a56b00ce7..cba4c2fae 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java @@ -703,7 +703,7 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager { * @param childArea the child to add to the cell */ public void addChildArea(Area childArea) { - if (curBlockArea != null) { + if (curBlockArea != null && childArea instanceof Block) { curBlockArea.addBlock((Block) childArea); } } -- cgit v1.2.3