From: Jeremias Maerki Date: Tue, 20 Nov 2007 10:20:29 +0000 (+0000) Subject: Bugzilla #43910: X-Git-Tag: fop-0_95beta~269 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ce09ef5c0ca510811c2dd9df67ae4ad213a663c8;p=xmlgraphics-fop.git Bugzilla #43910: Avoid a NullPointerException in AreaTreeHandler.endDocument(). Submitted by: David Delbecq git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@596600 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/area/AreaTreeHandler.java b/src/java/org/apache/fop/area/AreaTreeHandler.java index be06aabfc..6eb2d738b 100644 --- a/src/java/org/apache/fop/area/AreaTreeHandler.java +++ b/src/java/org/apache/fop/area/AreaTreeHandler.java @@ -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) { diff --git a/status.xml b/status.xml index 5a605f55c..fc39f46e4 100644 --- a/status.xml +++ b/status.xml @@ -28,6 +28,9 @@ + + Avoid a NullPointerException in AreaTreeHandler.endDocument(). + Bugfix: breaks generated by the merging algorithm for a table-row containing empty cells had always a penalty of 900.