aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-10-04 13:07:43 +0000
committerJeremias Maerki <jeremias@apache.org>2005-10-04 13:07:43 +0000
commitdd5611116e9c430499bce387b2168c019005ad61 (patch)
treedd25b8aafbc380c6322938088247ab70682fa128 /src/java
parent169da1a74af12417c5a64c349bbce4b3d34ba493 (diff)
downloadxmlgraphics-fop-dd5611116e9c430499bce387b2168c019005ad61.tar.gz
xmlgraphics-fop-dd5611116e9c430499bce387b2168c019005ad61.zip
Bugzilla #36871:
Better error messages when invalid XSL-FO is sent to FOP. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@293596 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/fo/FOTreeBuilder.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java
index 58942036f..595dc0566 100644
--- a/src/java/org/apache/fop/fo/FOTreeBuilder.java
+++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java
@@ -247,8 +247,10 @@ public class FOTreeBuilder extends DefaultHandler {
if (rootFObj == null) {
if (!namespaceURI.equals(FOElementMapping.URI)
|| !localName.equals("root")) {
- throw new SAXException(new IllegalArgumentException(
- "Error: First element must be fo:root formatting object"));
+ throw new SAXException(new ValidationException(
+ "Error: First element must be the fo:root formatting object. Found "
+ + FONode.getNodeString(namespaceURI, localName) + " instead."
+ + " Please make sure you're producing a valid XSL-FO document."));
}
} else { // check that incoming node is valid for currentFObj
if (namespaceURI.equals(FOElementMapping.URI)) {
@@ -293,6 +295,10 @@ public class FOTreeBuilder extends DefaultHandler {
*/
public void endElement(String uri, String localName, String rawName)
throws FOPException {
+ if (currentFObj == null) {
+ throw new FOPException("No current FO is available. The input document may not be "
+ + "a valid XSL-FO document.");
+ }
currentFObj.endOfNode();
if (currentPropertyList.getFObj() == currentFObj) {