aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorAndreas L. Delmelle <adelmelle@apache.org>2009-08-20 21:15:52 +0000
committerAndreas L. Delmelle <adelmelle@apache.org>2009-08-20 21:15:52 +0000
commitb0ece6c49dde5f2ddc6c38338e51a1e8d9131264 (patch)
tree49e4efdbb75ee673574cee45ed47496e171cf960 /src/java
parentfddf572a55a9b159af1820d2ba2f199bd5c2503c (diff)
downloadxmlgraphics-fop-b0ece6c49dde5f2ddc6c38338e51a1e8d9131264.tar.gz
xmlgraphics-fop-b0ece6c49dde5f2ddc6c38338e51a1e8d9131264.zip
Bugzilla 47710: White-space handling in retrieved markers throws a NullPointerException in some cases.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@806361 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/fo/FOTreeBuilder.java8
-rw-r--r--src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java12
2 files changed, 19 insertions, 1 deletions
diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java
index 7c77f0697..b1fe3bc13 100644
--- a/src/java/org/apache/fop/fo/FOTreeBuilder.java
+++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java
@@ -39,6 +39,7 @@ import org.apache.fop.apps.FormattingResults;
import org.apache.fop.area.AreaTreeHandler;
import org.apache.fop.fo.ElementMapping.Maker;
import org.apache.fop.fo.extensions.ExtensionElementMapping;
+import org.apache.fop.fo.extensions.pdf.PDFExtensionElementMapping;
import org.apache.fop.fo.pagination.Root;
import org.apache.fop.util.ContentHandlerFactory;
import org.apache.fop.util.ContentHandlerFactory.ObjectBuiltListener;
@@ -263,7 +264,8 @@ public class FOTreeBuilder extends DefaultHandler {
}
} else { // check that incoming node is valid for currentFObj
if (currentFObj.getNamespaceURI().equals(FOElementMapping.URI)
- || currentFObj.getNamespaceURI().equals(ExtensionElementMapping.URI)) {
+ || currentFObj.getNamespaceURI().equals(ExtensionElementMapping.URI)
+ || currentFObj.getNamespaceURI().equals(PDFExtensionElementMapping.URI)) {
currentFObj.validateChildNode(locator, namespaceURI, localName);
}
}
@@ -277,6 +279,7 @@ public class FOTreeBuilder extends DefaultHandler {
rootFObj.setBuilderContext(builderContext);
rootFObj.setFOEventHandler(foEventHandler);
}
+ builderContext.foIndex++;
propertyList = foNode.createPropertyList(
currentPropertyList, foEventHandler);
foNode.processNode(localName, getEffectiveLocator(),
@@ -288,6 +291,9 @@ public class FOTreeBuilder extends DefaultHandler {
builderContext.switchMarkerContext(true);
}
}
+ if (foNode.getNameId() == Constants.FO_PAGE_SEQUENCE) {
+ builderContext.getXMLWhiteSpaceHandler().reset();
+ }
} catch (IllegalArgumentException e) {
throw new SAXException(e);
}
diff --git a/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java b/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java
index cad9fb729..51e84551c 100644
--- a/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java
+++ b/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java
@@ -234,6 +234,18 @@ public class XMLWhiteSpaceHandler {
}
/**
+ * Reset the handler, release all references
+ */
+ protected final void reset() {
+ if (pendingInlines != null) {
+ pendingInlines.clear();
+ }
+ nestedBlockStack.clear();
+ charIter = null;
+ firstWhiteSpaceInSeq = null;
+ }
+
+ /**
* Handle white-space for the fo that is passed in, starting at
* firstTextNode (when a nested FO is encountered)
* @param fo the FO for which to handle white-space