]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugzilla #43910:
authorJeremias Maerki <jeremias@apache.org>
Tue, 20 Nov 2007 10:20:29 +0000 (10:20 +0000)
committerJeremias Maerki <jeremias@apache.org>
Tue, 20 Nov 2007 10:20:29 +0000 (10:20 +0000)
Avoid a NullPointerException in AreaTreeHandler.endDocument().
Submitted by: David Delbecq <delbd.at.oma.be>

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@596600 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/area/AreaTreeHandler.java
status.xml

index be06aabfc2498cd1b4a4c3fba4bacc9c9f79ceab..6eb2d738bedcd0f332a61d2cbb4f16707b8f93db 100644 (file)
@@ -21,30 +21,27 @@ package org.apache.fop.area;
 
 // Java
 import java.io.OutputStream;
-import java.util.List;
 import java.util.Iterator;
+import java.util.List;
 
-// XML
 import org.xml.sax.SAXException;
 
-// Apache
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.FormattingResults;
 import org.apache.fop.datatypes.Numeric;
 import org.apache.fop.fo.FOEventHandler;
 import org.apache.fop.fo.extensions.ExtensionAttachment;
+import org.apache.fop.fo.extensions.destination.Destination;
 import org.apache.fop.fo.pagination.PageSequence;
 import org.apache.fop.fo.pagination.Root;
 import org.apache.fop.fo.pagination.bookmarks.BookmarkTree;
-import org.apache.fop.layoutmgr.PageSequenceLayoutManager;
 import org.apache.fop.layoutmgr.LayoutManagerMaker;
 import org.apache.fop.layoutmgr.LayoutManagerMapping;
-
-import org.apache.fop.area.DestinationData;
-import org.apache.fop.fo.extensions.destination.Destination;
+import org.apache.fop.layoutmgr.PageSequenceLayoutManager;
 
 /**
  * Area tree handler for formatting objects.
@@ -261,25 +258,26 @@ public class AreaTreeHandler extends FOEventHandler {
 
         finishPrevPageSequence(null);
         // process fox:destination elements
-        List destinationList = rootFObj.getDestinationList();
-        if (destinationList != null) {
-            while (destinationList.size() > 0) {
-                Destination destination = (Destination) destinationList.remove(0);
-                DestinationData destinationData = new DestinationData(destination);
-                addOffDocumentItem(destinationData);
+        if (rootFObj != null) {
+            List destinationList = rootFObj.getDestinationList();
+            if (destinationList != null) {
+                while (destinationList.size() > 0) {
+                    Destination destination = (Destination) destinationList.remove(0);
+                    DestinationData destinationData = new DestinationData(destination);
+                    addOffDocumentItem(destinationData);
+                }
             }
-        }
-        // process fo:bookmark-tree
-        BookmarkTree bookmarkTree = rootFObj.getBookmarkTree();
-        if (bookmarkTree != null) {
-            BookmarkData data = new BookmarkData(bookmarkTree);
-            addOffDocumentItem(data);
-            if (!data.isResolved()) {
-                // bookmarks did not fully resolve, add anyway. (hacky? yeah)
-                model.handleOffDocumentItem(data);
+            // process fo:bookmark-tree
+            BookmarkTree bookmarkTree = rootFObj.getBookmarkTree();
+            if (bookmarkTree != null) {
+                BookmarkData data = new BookmarkData(bookmarkTree);
+                addOffDocumentItem(data);
+                if (!data.isResolved()) {
+                    // bookmarks did not fully resolve, add anyway. (hacky? yeah)
+                    model.handleOffDocumentItem(data);
+                }
             }
         }
-
         model.endDocument();
 
         if (statistics != null) {
index 5a605f55c8666edd1ceb73a3e464e36b3003cd81..fc39f46e48dd9c32c8f68e9b257ea5f09c74e6f3 100644 (file)
@@ -28,6 +28,9 @@
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Code" dev="JM" type="fix" fixes-bug="43910" due-to="David Delbecq">
+        Avoid a NullPointerException in AreaTreeHandler.endDocument().
+      </action>
       <action context="Code" dev="VH" type="fix" fixes-bug="43766">
         Bugfix: breaks generated by the merging algorithm for a table-row containing empty cells had always a
         penalty of 900.