aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
authorLuis Bernardo <lbernardo@apache.org>2013-07-12 23:02:02 +0000
committerLuis Bernardo <lbernardo@apache.org>2013-07-12 23:02:02 +0000
commitc078247bdc67632eb9e6fda7fa3ea19513241220 (patch)
tree6071fe232f4fd4f0429009d3f02948e71b015608 /src/java/org/apache
parent5db8b6764b30432c1a7affb638e2a0a93b811c85 (diff)
downloadxmlgraphics-fop-c078247bdc67632eb9e6fda7fa3ea19513241220.tar.gz
xmlgraphics-fop-c078247bdc67632eb9e6fda7fa3ea19513241220.zip
FOP-2271: XSL Infinite loop; patch submitted by Simon Steiner.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1502722 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/fop/fo/FOTreeBuilder.java27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java
index 84d03db83..49694eebd 100644
--- a/src/java/org/apache/fop/fo/FOTreeBuilder.java
+++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java
@@ -83,6 +83,7 @@ public class FOTreeBuilder extends DefaultHandler {
private boolean empty = true;
private int depth;
+ private boolean errorinstart;
/**
* <code>FOTreeBuilder</code> constructor
@@ -172,20 +173,28 @@ public class FOTreeBuilder extends DefaultHandler {
public void startElement(String namespaceURI, String localName, String rawName,
Attributes attlist) throws SAXException {
this.depth++;
- delegate.startElement(namespaceURI, localName, rawName, attlist);
+ errorinstart = false;
+ try {
+ delegate.startElement(namespaceURI, localName, rawName, attlist);
+ } catch (SAXException e) {
+ errorinstart = true;
+ throw e;
+ }
}
/** {@inheritDoc} */
public void endElement(String uri, String localName, String rawName)
throws SAXException {
- this.delegate.endElement(uri, localName, rawName);
- this.depth--;
- if (depth == 0) {
- if (delegate != mainFOHandler) {
- //Return from sub-handler back to main handler
- delegate.endDocument();
- delegate = mainFOHandler;
- delegate.endElement(uri, localName, rawName);
+ if (!errorinstart) {
+ this.delegate.endElement(uri, localName, rawName);
+ this.depth--;
+ if (depth == 0) {
+ if (delegate != mainFOHandler) {
+ //Return from sub-handler back to main handler
+ delegate.endDocument();
+ delegate = mainFOHandler;
+ delegate.endElement(uri, localName, rawName);
+ }
}
}
}