summaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2009-10-20 12:19:54 +0000
committerVincent Hennebert <vhennebert@apache.org>2009-10-20 12:19:54 +0000
commit77d320fbcda503079eab89eaa12bedf6a1122769 (patch)
treef2c27bd9bd1dfc09112bf257752b0cfa09615105 /src/java
parent28cd945acabbe23b213d83a4ca2899589a8865a6 (diff)
downloadxmlgraphics-fop-77d320fbcda503079eab89eaa12bedf6a1122769.tar.gz
xmlgraphics-fop-77d320fbcda503079eab89eaa12bedf6a1122769.zip
Bugfix: crash occurring when no restartable element could be found after a changing IPD break
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@827047 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/layoutmgr/AbstractBreaker.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
index 825840351..2ee4a8a3a 100644
--- a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
+++ b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
@@ -400,9 +400,11 @@ public abstract class AbstractBreaker {
if (position instanceof SpaceResolver.SpaceHandlingBreakPosition) {
/* Retrieve the original position wrapped into this space position */
positionAtBreak = position.getPosition();
+ } else {
+ positionAtBreak = null;
}
}
- if (positionAtBreak.getIndex() == -1) {
+ if (positionAtBreak != null && positionAtBreak.getIndex() == -1) {
/*
* This is an indication that we are between two blocks
* (possibly surrounded by another block), not inside a
@@ -678,8 +680,23 @@ public abstract class AbstractBreaker {
BlockSequence blockList;
List returnedList;
- if (positionAtIPDChange == null) {
+ if (firstElements == null) {
returnedList = getNextKnuthElements(childLC, alignment);
+ } else if (positionAtIPDChange == null) {
+ /*
+ * No restartable element found after changing IPD break. Simply add the
+ * non-restartable elements found after the break.
+ */
+ returnedList = firstElements;
+ /*
+ * Remove the last 3 penalty-filler-forced break elements that were added by
+ * the Knuth algorithm. They will be re-added later on.
+ */
+ ListIterator iter = returnedList.listIterator(returnedList.size());
+ for (int i = 0; i < 3; i++) {
+ iter.previous();
+ iter.remove();
+ }
} else {
returnedList = getNextKnuthElements(childLC, alignment, positionAtIPDChange,
restartAtLM);