diff options
author | Simon Pepping <spepping@apache.org> | 2006-05-19 15:10:44 +0000 |
---|---|---|
committer | Simon Pepping <spepping@apache.org> | 2006-05-19 15:10:44 +0000 |
commit | 276670d6bbb7cf51f8f8365675335f4ac945209e (patch) | |
tree | 00c0da5e3a75f667f2ea7085929b2475a8228f02 /src/java/org/apache | |
parent | 5db46401762875432068ec08a6558213b80d540f (diff) | |
download | xmlgraphics-fop-276670d6bbb7cf51f8f8365675335f4ac945209e.tar.gz xmlgraphics-fop-276670d6bbb7cf51f8f8365675335f4ac945209e.zip |
An emergency patch to avoid that a non-breaking space at the end of an
fo:inline with padding, followed by another fo:inline, while
text-align is justify, does not cause a NullPointerException due to
InlineStackingLayoutManager.addALetterSpaceTo(). Patch submitted by
Max Berger <max@berger.name>, applied with some modifications. This
patch solves bug 39571.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@407819 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java b/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java index 0e48eb1ae..f66c0d119 100644 --- a/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java +++ b/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java @@ -140,7 +140,9 @@ public class InlineKnuthSequence extends KnuthSequence { addAll(((InlineLevelLayoutManager) prevBox.getLayoutManager()) .addALetterSpaceTo(oldList)); - if (((KnuthInlineBox) prevBox).isAnchor()) { + // prevBox may not be a KnuthInlineBox; + // this may happen if it is a padding box; see bug 39571. + if ( prevBox instanceof KnuthInlineBox && ((KnuthInlineBox) prevBox).isAnchor()) { // prevBox represents a footnote citation: copy footnote info // from prevBox to the new box KnuthInlineBox newBox = (KnuthInlineBox) getLast(); diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java index 515caf578..b31fb8b42 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java @@ -292,9 +292,13 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager element.setPosition(((NonLeafPosition)element.getPosition()).getPosition()); } - oldList = ((InlineLevelLayoutManager) - element.getLayoutManager()).addALetterSpaceTo(oldList); - + // The last element may not have a layout manager (its position == null); + // this may happen if it is a padding box; see bug 39571. + InlineLevelLayoutManager LM = + (InlineLevelLayoutManager) element.getLayoutManager(); + if (LM != null) { + oldList = LM.addALetterSpaceTo(oldList); + } // "wrap" again the Position stored in each element of oldList oldListIterator = oldList.listIterator(); while (oldListIterator.hasNext()) { |