aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/org/apache/fop/fo/FOTreeBuilder.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java
index c0aa87a44..f674d58c8 100644
--- a/src/java/org/apache/fop/fo/FOTreeBuilder.java
+++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java
@@ -48,6 +48,8 @@ public class FOTreeBuilder extends DefaultHandler {
/** The registry for ElementMapping instances */
protected ElementMappingRegistry elementMappingRegistry;
+ //TODO Remove the ElementMappingRegistry from here and move it to a new environmental class
+ //FOTreeBuilder should be a "one-use" component.
/**
* The root of the formatting object tree
@@ -76,6 +78,8 @@ public class FOTreeBuilder extends DefaultHandler {
/** The user agent for this processing run. */
private FOUserAgent userAgent;
+ private boolean used = false;
+
/**
* FOTreeBuilder constructor
* @param outputFormat the MIME type of the output format to use (ex. "application/pdf").
@@ -143,6 +147,11 @@ public class FOTreeBuilder extends DefaultHandler {
* @see org.xml.sax.ContentHandler#startDocument()
*/
public void startDocument() throws SAXException {
+ if (used) {
+ throw new IllegalStateException("FOTreeBuilder (and the Fop class) cannot be reused."
+ + " Please instantiate a new instance.");
+ }
+ used = true;
rootFObj = null; // allows FOTreeBuilder to be reused
if (log.isDebugEnabled()) {
log.debug("Building formatting object tree");
@@ -300,14 +309,5 @@ public class FOTreeBuilder extends DefaultHandler {
}
}
- /**
- * Resets this object for another run.
- */
- public void reset() {
- currentFObj = null;
- rootFObj = null;
- foEventHandler = null;
- }
-
}