From: Jeremias Maerki Date: Tue, 21 Jun 2011 09:44:42 +0000 (+0000) Subject: Fixed regression introduced by SVN rev 1088079: X-Git-Tag: fop-1_1rc1old~206 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1df8c0b1dbd25c96a90757fac3db1daf238991af;p=xmlgraphics-fop.git Fixed regression introduced by SVN rev 1088079: Endless loop with empty fo:inline. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1137921 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java index 5e696801d..db7d1edc8 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java @@ -649,8 +649,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager Paragraph lastPar = null; - InlineLevelLayoutManager curLM = (InlineLevelLayoutManager) getChildLM(); - while (curLM != null) { + InlineLevelLayoutManager curLM; + while ((curLM = (InlineLevelLayoutManager) getChildLM()) != null) { List inlineElements = curLM.getNextKnuthElements(inlineLC, effectiveAlignment); if (inlineElements == null || inlineElements.size() == 0) { /* curLM.getNextKnuthElements() returned null or an empty list; @@ -747,7 +747,6 @@ public class LineLayoutManager extends InlineStackingLayoutManager } } } // end of loop over returnedList - curLM = (InlineLevelLayoutManager) getChildLM(); } if (lastPar != null) { @@ -1149,6 +1148,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager } /** {@inheritDoc} */ + @Override public List getChangedKnuthElements(List oldList, int alignment) { List returnList = new LinkedList(); for (int p = 0; p < knuthParagraphs.size(); p++) { @@ -1419,7 +1419,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager private void addInlineArea(LayoutContext context, LineBreakPosition lbp, boolean isLastPosition) { - KnuthSequence seq = (KnuthSequence) knuthParagraphs.get(lbp.parIndex); + KnuthSequence seq = knuthParagraphs.get(lbp.parIndex); int startElementIndex = lbp.startIndex; int endElementIndex = lbp.getLeafPos(); diff --git a/test/layoutengine/standard-testcases/inline_empty.xml b/test/layoutengine/standard-testcases/inline_empty.xml new file mode 100644 index 000000000..1ff8d93b5 --- /dev/null +++ b/test/layoutengine/standard-testcases/inline_empty.xml @@ -0,0 +1,46 @@ + + + + + +

+ This test checks an empty fo:inline. This used to create an endless loop + so we're checking that here so it doesn't happen again. +

+
+ + + + + + + + + + No endless loop, please: + + + + + + + + 3 + + +