]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
LineArea had a finalize method which caused a NPE when called from the garbage collec...
authorManuel Mall <manuel@apache.org>
Wed, 28 Dec 2005 03:08:49 +0000 (03:08 +0000)
committerManuel Mall <manuel@apache.org>
Wed, 28 Dec 2005 03:08:49 +0000 (03:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@359364 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/area/LineArea.java
src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java

index 4f13ad65fe3982dfdb24baff562234152b60061d..15d22548f400fc483c057202f73090aa6d257a7f 100644 (file)
@@ -190,7 +190,7 @@ public class LineArea extends Area {
                 // if the LineArea has already been added to the area tree,
                 // call finalize(); otherwise, wait for the LineLM to call it
                 if (adjustingInfo.bAddedToAreaTree) {
-                    finalize();
+                    finalise();
                 }
                 break;
             default:
@@ -203,7 +203,7 @@ public class LineArea extends Area {
      * and destroy the AdjustingInfo object if there are
      * no UnresolvedAreas left
      */
-    public void finalize() {
+    public void finalise() {
         if (adjustingInfo.lineAlignment == Constants.EN_JUSTIFY) {
             // justified line: apply the variation factor
             boolean bUnresolvedAreasPresent = false;
index 7883397900ed90dc1071de0867297280ea410810..efe3e28ce153f024877844a9efabdff4cef06d02 100644 (file)
@@ -105,7 +105,18 @@ public class InlineKnuthSequence extends KnuthSequence  {
     }
 
     public void addALetterSpace() {
-        KnuthBox prevBox = (KnuthBox) removeLast();
+        KnuthBox prevBox = (KnuthBox) getLast();
+        if (prevBox.isAuxiliary()
+            && (size() < 4
+                || !getElement(size()-2).isGlue()
+                || !getElement(size()-3).isPenalty()
+                || !getElement(size()-4).isBox()
+               )
+           ) {
+            // Not the sequence we are expecting
+            return;
+        }
+        removeLast();
         LinkedList oldList = new LinkedList();
         // if there are two consecutive KnuthBoxes the
         // first one does not represent a whole word,