From 33e6293e88e33dfba73f66e7afee63323f884119 Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Tue, 27 Jul 2004 05:12:41 +0000 Subject: [PATCH] Switch from IllegalArgumentException to SAXParseException for errors found in the input FO. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197843 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fo/FONode.java | 40 ++++++++++--------- src/java/org/apache/fop/fo/FOTreeBuilder.java | 10 ++--- .../apache/fop/fo/extensions/Bookmarks.java | 5 ++- .../org/apache/fop/fo/flow/BasicLink.java | 3 +- src/java/org/apache/fop/fo/flow/Block.java | 3 +- src/java/org/apache/fop/fo/flow/Footnote.java | 3 +- .../org/apache/fop/fo/flow/FootnoteBody.java | 3 +- src/java/org/apache/fop/fo/flow/Inline.java | 3 +- .../org/apache/fop/fo/flow/ListBlock.java | 3 +- src/java/org/apache/fop/fo/flow/ListItem.java | 3 +- .../org/apache/fop/fo/flow/ListItemLabel.java | 3 +- .../org/apache/fop/fo/flow/PageNumber.java | 3 +- src/java/org/apache/fop/fo/flow/Table.java | 3 +- .../org/apache/fop/fo/flow/TableBody.java | 3 +- .../org/apache/fop/fo/flow/TableCell.java | 3 +- .../org/apache/fop/fo/flow/TableColumn.java | 3 +- src/java/org/apache/fop/fo/flow/TableRow.java | 3 +- .../fop/fo/pagination/ColorProfile.java | 7 ++-- .../ConditionalPageMasterReference.java | 4 +- .../fop/fo/pagination/Declarations.java | 6 ++- .../org/apache/fop/fo/pagination/Flow.java | 6 ++- .../fop/fo/pagination/LayoutMasterSet.java | 6 ++- .../fop/fo/pagination/PageSequence.java | 6 ++- .../fop/fo/pagination/PageSequenceMaster.java | 6 ++- .../org/apache/fop/fo/pagination/Region.java | 7 +++- .../apache/fop/fo/pagination/RegionBA.java | 5 ++- .../apache/fop/fo/pagination/RegionBASE.java | 3 +- .../RepeatablePageMasterAlternatives.java | 6 ++- .../RepeatablePageMasterReference.java | 4 +- .../org/apache/fop/fo/pagination/Root.java | 8 +++- .../pagination/SinglePageMasterReference.java | 4 +- .../fop/fo/pagination/StaticContent.java | 6 ++- .../org/apache/fop/fo/pagination/Title.java | 4 +- 33 files changed, 119 insertions(+), 66 deletions(-) diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java index 33173df46..c3b012346 100644 --- a/src/java/org/apache/fop/fo/FONode.java +++ b/src/java/org/apache/fop/fo/FONode.java @@ -26,6 +26,7 @@ import org.apache.commons.logging.LogFactory; // XML import org.xml.sax.Attributes; import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -134,9 +135,10 @@ public abstract class FONode { * called within FObj constructor * @param namespaceURI namespace of incoming node * @param localName (e.g. "table" for "fo:table") - * @throws IllegalArgumentException if incoming node not valid for parent + * @throws SAXParseException if incoming node not valid for parent */ - protected void validateChildNode(Locator loc, String namespaceURI, String localName) {} + protected void validateChildNode(Locator loc, String namespaceURI, String localName) + throws SAXParseException {} /** * Adds characters (does nothing here) @@ -160,7 +162,7 @@ public abstract class FONode { /** * */ - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { // do nothing by default } @@ -242,10 +244,10 @@ public abstract class FONode { * @param loc org.xml.sax.Locator object of the error (*not* parent node) * @param offendingNode incoming node that would cause a duplication. */ - protected void tooManyNodesError(Locator loc, String offendingNode) { - throw new IllegalArgumentException( - errorText(loc) + getName() + ", only one " - + offendingNode + " may be declared."); + protected void tooManyNodesError(Locator loc, String offendingNode) + throws SAXParseException { + throw new SAXParseException (errorText(loc) + getName() + ", only one " + + offendingNode + " may be declared.", loc); } /** @@ -256,10 +258,9 @@ public abstract class FONode { * @param tooEarlyNode string name of node that should be later in document */ protected void nodesOutOfOrderError(Locator loc, String tooLateNode, - String tooEarlyNode) { - throw new IllegalArgumentException( - errorText(loc) + "For " + getName() + ", " + tooLateNode - + " must be declared before " + tooEarlyNode + "."); + String tooEarlyNode) throws SAXParseException { + throw new SAXParseException (errorText(loc) + "For " + getName() + ", " + tooLateNode + + " must be declared before " + tooEarlyNode + ".", loc); } /** @@ -269,10 +270,10 @@ public abstract class FONode { * @param nsURI namespace URI of incoming invalid node * @param lName local name (i.e., no prefix) of incoming node */ - protected void invalidChildError(Locator loc, String nsURI, String lName) { - throw new IllegalArgumentException( - errorText(loc) + getNodeString(nsURI, lName) + - " is not a valid child element of " + getName() + "."); + protected void invalidChildError(Locator loc, String nsURI, String lName) + throws SAXParseException { + throw new SAXParseException (errorText(loc) + getNodeString(nsURI, lName) + + " is not a valid child element of " + getName() + ".", loc); } /** @@ -281,10 +282,11 @@ public abstract class FONode { * @param contentModel The XSL Content Model for the fo: object. * or a similar description indicating child elements needed. */ - protected void missingChildElementError(String contentModel) { - throw new IllegalArgumentException( - errorText(line, column) + getName() + " is missing child elements. \n" + - "Required Content Model: " + contentModel); + protected void missingChildElementError(String contentModel) + throws SAXParseException { + throw new SAXParseException(errorText(line, column) + getName() + + " is missing child elements. \nRequired Content Model: " + + contentModel, null, null, line, column); } /** diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java index c45f1048a..9fbdbab49 100644 --- a/src/java/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java @@ -255,8 +255,8 @@ public class FOTreeBuilder extends DefaultHandler { } else { // check that incoming node is valid for currentFObj try { currentFObj.validateChildNode(locator, namespaceURI, localName); - } catch (IllegalArgumentException e) { - throw new SAXException(e); + } catch (SAXParseException e) { + throw e; } } @@ -287,11 +287,11 @@ public class FOTreeBuilder extends DefaultHandler { * @see org.xml.sax.ContentHandler#endElement(String, String, String) */ public void endElement(String uri, String localName, String rawName) - throws SAXException { + throws SAXParseException { try { currentFObj.endOfNode(); - } catch (IllegalArgumentException e) { - throw new SAXException(e); + } catch (SAXParseException e) { + throw e; } currentFObj = currentFObj.getParent(); diff --git a/src/java/org/apache/fop/fo/extensions/Bookmarks.java b/src/java/org/apache/fop/fo/extensions/Bookmarks.java index a9cac572b..e4c9f1b7a 100644 --- a/src/java/org/apache/fop/fo/extensions/Bookmarks.java +++ b/src/java/org/apache/fop/fo/extensions/Bookmarks.java @@ -21,6 +21,9 @@ package org.apache.fop.fo.extensions; // Java import java.util.ArrayList; +// XML +import org.xml.sax.SAXParseException; + // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FOTreeVisitor; @@ -57,7 +60,7 @@ public class Bookmarks extends ExtensionObj { * the bookmark data from the child elements and add * the extension to the area tree. */ - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { ((Root) parent).setBookmarks(this); } diff --git a/src/java/org/apache/fop/fo/flow/BasicLink.java b/src/java/org/apache/fop/fo/flow/BasicLink.java index b3db13535..08592886e 100644 --- a/src/java/org/apache/fop/fo/flow/BasicLink.java +++ b/src/java/org/apache/fop/fo/flow/BasicLink.java @@ -20,6 +20,7 @@ package org.apache.fop.fo.flow; // XML import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -140,7 +141,7 @@ public class BasicLink extends Inline { /** * @see org.apache.fop.fo.FONode#end */ - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { super.endOfNode(); getFOInputHandler().endLink(); } diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index b01fb3b53..f44d65c00 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -21,6 +21,7 @@ package org.apache.fop.fo.flow; // XML import org.xml.sax.Attributes; import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -237,7 +238,7 @@ public class Block extends FObjMixed { /** * @see org.apache.fop.fo.FONode#end */ - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { handleWhiteSpace(); getFOInputHandler().endBlock(this); } diff --git a/src/java/org/apache/fop/fo/flow/Footnote.java b/src/java/org/apache/fop/fo/flow/Footnote.java index f72ddd403..1575a81f7 100644 --- a/src/java/org/apache/fop/fo/flow/Footnote.java +++ b/src/java/org/apache/fop/fo/flow/Footnote.java @@ -21,6 +21,7 @@ package org.apache.fop.fo.flow; // XML import org.xml.sax.Attributes; import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -78,7 +79,7 @@ public class Footnote extends FObj { fotv.serveFootnote(this); } - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { super.endOfNode(); getFOInputHandler().endFootnote(this); } diff --git a/src/java/org/apache/fop/fo/flow/FootnoteBody.java b/src/java/org/apache/fop/fo/flow/FootnoteBody.java index 34504e4e4..9564350db 100644 --- a/src/java/org/apache/fop/fo/flow/FootnoteBody.java +++ b/src/java/org/apache/fop/fo/flow/FootnoteBody.java @@ -21,6 +21,7 @@ package org.apache.fop.fo.flow; // XML import org.xml.sax.Attributes; import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -60,7 +61,7 @@ public class FootnoteBody extends FObj { fotv.serveFootnoteBody(this); } - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { super.endOfNode(); getFOInputHandler().endFootnoteBody(this); } diff --git a/src/java/org/apache/fop/fo/flow/Inline.java b/src/java/org/apache/fop/fo/flow/Inline.java index 64819ad46..a7d15f21f 100644 --- a/src/java/org/apache/fop/fo/flow/Inline.java +++ b/src/java/org/apache/fop/fo/flow/Inline.java @@ -20,6 +20,7 @@ package org.apache.fop.fo.flow; // XML import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -138,7 +139,7 @@ public class Inline extends FObjMixed { /** * @see org.apache.fop.fo.FONode#end */ - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { getFOInputHandler().endInline(this); } diff --git a/src/java/org/apache/fop/fo/flow/ListBlock.java b/src/java/org/apache/fop/fo/flow/ListBlock.java index f90ef8759..2aa9c5441 100644 --- a/src/java/org/apache/fop/fo/flow/ListBlock.java +++ b/src/java/org/apache/fop/fo/flow/ListBlock.java @@ -20,6 +20,7 @@ package org.apache.fop.fo.flow; // XML import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -136,7 +137,7 @@ public class ListBlock extends FObj { fotv.serveListBlock(this); } - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { super.endOfNode(); getFOInputHandler().endList(this); } diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/java/org/apache/fop/fo/flow/ListItem.java index 35862bd7d..5fa73636a 100644 --- a/src/java/org/apache/fop/fo/flow/ListItem.java +++ b/src/java/org/apache/fop/fo/flow/ListItem.java @@ -20,6 +20,7 @@ package org.apache.fop.fo.flow; // XML import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -145,7 +146,7 @@ public class ListItem extends FObj { fotv.serveListItem(this); } - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { super.endOfNode(); getFOInputHandler().endListItem(this); } diff --git a/src/java/org/apache/fop/fo/flow/ListItemLabel.java b/src/java/org/apache/fop/fo/flow/ListItemLabel.java index 938f91b11..358453a8e 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemLabel.java +++ b/src/java/org/apache/fop/fo/flow/ListItemLabel.java @@ -20,6 +20,7 @@ package org.apache.fop.fo.flow; // XML import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -83,7 +84,7 @@ public class ListItemLabel extends FObj { fotv.serveListItemLabel(this); } - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { super.endOfNode(); getFOInputHandler().endListLabel(); } diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java index 16929732e..0035afea7 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/java/org/apache/fop/fo/flow/PageNumber.java @@ -20,6 +20,7 @@ package org.apache.fop.fo.flow; // XML import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -128,7 +129,7 @@ public class PageNumber extends FObj { fotv.servePageNumber(this); } - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { getFOInputHandler().endPageNumber(this); } diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java index 42000aa3e..3a430f52b 100644 --- a/src/java/org/apache/fop/fo/flow/Table.java +++ b/src/java/org/apache/fop/fo/flow/Table.java @@ -23,6 +23,7 @@ import java.util.ArrayList; // XML import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -201,7 +202,7 @@ public class Table extends FObj { fotv.serveTable(this); } - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { getFOInputHandler().endTable(this); } diff --git a/src/java/org/apache/fop/fo/flow/TableBody.java b/src/java/org/apache/fop/fo/flow/TableBody.java index 8444617f5..20e392181 100644 --- a/src/java/org/apache/fop/fo/flow/TableBody.java +++ b/src/java/org/apache/fop/fo/flow/TableBody.java @@ -21,6 +21,7 @@ package org.apache.fop.fo.flow; // XML import org.xml.sax.Attributes; import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -104,7 +105,7 @@ public class TableBody extends FObj { fotv.serveTableBody(this); } - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { getFOInputHandler().endBody(this); } diff --git a/src/java/org/apache/fop/fo/flow/TableCell.java b/src/java/org/apache/fop/fo/flow/TableCell.java index 55631475b..4dcf265cf 100644 --- a/src/java/org/apache/fop/fo/flow/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/TableCell.java @@ -21,6 +21,7 @@ package org.apache.fop.fo.flow; // XML import org.xml.sax.Attributes; import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -348,7 +349,7 @@ public class TableCell extends FObj { fotv.serveTableCell(this); } - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { getFOInputHandler().endCell(this); } diff --git a/src/java/org/apache/fop/fo/flow/TableColumn.java b/src/java/org/apache/fop/fo/flow/TableColumn.java index a8f7d4fc6..7f7089783 100644 --- a/src/java/org/apache/fop/fo/flow/TableColumn.java +++ b/src/java/org/apache/fop/fo/flow/TableColumn.java @@ -20,6 +20,7 @@ package org.apache.fop.fo.flow; // XML import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -123,7 +124,7 @@ public class TableColumn extends FObj { fotv.serveTableColumn(this); } - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { getFOInputHandler().endColumn(this); } diff --git a/src/java/org/apache/fop/fo/flow/TableRow.java b/src/java/org/apache/fop/fo/flow/TableRow.java index 39c34b512..4b3a1b41f 100644 --- a/src/java/org/apache/fop/fo/flow/TableRow.java +++ b/src/java/org/apache/fop/fo/flow/TableRow.java @@ -20,6 +20,7 @@ package org.apache.fop.fo.flow; // XML import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -144,7 +145,7 @@ public class TableRow extends FObj { fotv.serveTableRow(this); } - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { getFOInputHandler().endRow(this); } diff --git a/src/java/org/apache/fop/fo/pagination/ColorProfile.java b/src/java/org/apache/fop/fo/pagination/ColorProfile.java index 0be5c49d2..320626a8b 100644 --- a/src/java/org/apache/fop/fo/pagination/ColorProfile.java +++ b/src/java/org/apache/fop/fo/pagination/ColorProfile.java @@ -27,7 +27,7 @@ import java.io.InputStream; // XML import org.xml.sax.Locator; -import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.datatypes.ColorType; @@ -56,7 +56,8 @@ public class ColorProfile extends FObj { * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) XSL 1.0/FOP: EMPTY (no child nodes permitted) */ - protected void validateChildNode(Locator loc, String nsURI, String localName) { + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { invalidChildError(loc, nsURI, localName); } @@ -65,7 +66,7 @@ public class ColorProfile extends FObj { * Extract instance variables from the collection of properties for this * object. */ - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { src = this.propertyList.get(PR_SRC).getString(); profileName = this.propertyList.get(PR_COLOR_PROFILE_NAME).getString(); intent = this.propertyList.get(PR_RENDERING_INTENT).getEnum(); diff --git a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java index 71180dc45..045a2a3a1 100644 --- a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java @@ -21,6 +21,7 @@ package org.apache.fop.fo.pagination; // XML import org.xml.sax.Attributes; import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; @@ -57,7 +58,8 @@ public class ConditionalPageMasterReference extends FObj { * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL/FOP Content Model: empty */ - protected void validateChildNode(Locator loc, String nsURI, String localName) { + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { invalidChildError(loc, nsURI, localName); } diff --git a/src/java/org/apache/fop/fo/pagination/Declarations.java b/src/java/org/apache/fop/fo/pagination/Declarations.java index b5506cefc..02292802f 100644 --- a/src/java/org/apache/fop/fo/pagination/Declarations.java +++ b/src/java/org/apache/fop/fo/pagination/Declarations.java @@ -26,6 +26,7 @@ import java.util.Iterator; // XML import org.xml.sax.Attributes; import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FOElementMapping; @@ -60,7 +61,8 @@ public class Declarations extends FObj { XSL 1.0: (color-profile)+ (and non-XSL NS nodes) FOP/XSL 1.1: (color-profile)* (and non-XSL NS nodes) */ - protected void validateChildNode(Locator loc, String nsURI, String localName) { + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { if (nsURI == FOElementMapping.URI) { if (!localName.equals("color-profile")) { invalidChildError(loc, nsURI, localName); @@ -72,7 +74,7 @@ public class Declarations extends FObj { * At the end of this element sort out the child into * a hashmap of color profiles and a list of external xml. */ - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { if (childNodes != null) { for (Iterator iter = childNodes.iterator(); iter.hasNext();) { FONode node = (FONode)iter.next(); diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java index ccfab4363..400ff45dc 100644 --- a/src/java/org/apache/fop/fo/pagination/Flow.java +++ b/src/java/org/apache/fop/fo/pagination/Flow.java @@ -24,6 +24,7 @@ import java.util.ArrayList; // XML import org.xml.sax.Attributes; import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; @@ -73,7 +74,8 @@ public class Flow extends FObj { * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL/FOP Content Model: marker* (%block;)+ */ - protected void validateChildNode(Locator loc, String nsURI, String localName) { + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { if (nsURI == FOElementMapping.URI && localName.equals("marker")) { if (blockItemFound) { nodesOutOfOrderError(loc, "fo:marker", "(%block;)"); @@ -90,7 +92,7 @@ public class Flow extends FObj { * StructureRenderer that we are at the end of the flow. * @see org.apache.fop.fo.FONode#end */ - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { if (!blockItemFound) { missingChildElementError("marker* (%block;)+"); } diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java index ce46c30b1..1504c4201 100644 --- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java @@ -25,6 +25,7 @@ import java.util.Map; // XML import org.xml.sax.Attributes; import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; @@ -58,7 +59,8 @@ public class LayoutMasterSet extends FObj { * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) XSL/FOP: (simple-page-master|page-sequence-master)+ */ - protected void validateChildNode(Locator loc, String nsURI, String localName) { + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { if (nsURI == FOElementMapping.URI) { if (!localName.equals("simple-page-master") && !localName.equals("page-sequence-master")) { @@ -72,7 +74,7 @@ public class LayoutMasterSet extends FObj { /** * @see org.apache.fop.fo.FONode#end */ - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { if (childNodes == null) { missingChildElementError("(simple-page-master|page-sequence-master)+"); } diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 61b48a0f1..75013e7cc 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -24,6 +24,7 @@ import java.util.HashMap; // XML import org.xml.sax.Attributes; import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; @@ -136,7 +137,8 @@ public class PageSequence extends FObj { * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) XSL/FOP Content Model: (title?,static-content*,flow) */ - protected void validateChildNode(Locator loc, String nsURI, String localName) { + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { if (nsURI == FOElementMapping.URI) { if (localName.equals("title")) { if (titleFO != null) { @@ -167,7 +169,7 @@ public class PageSequence extends FObj { * This passes the end page sequence to the structure handler * so it can act upon that. */ - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { if (mainFlow == null) { missingChildElementError("(title?,static-content*,flow)"); } diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java index 5157ae0b9..cdb8c86e4 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java @@ -24,6 +24,7 @@ import java.util.List; // XML import org.xml.sax.Attributes; import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.Constants; @@ -67,7 +68,8 @@ public class PageSequenceMaster extends FObj { * XSL/FOP: (single-page-master-reference|repeatable-page-master-reference| * repeatable-page-master-alternatives)+ */ - protected void validateChildNode(Locator loc, String nsURI, String localName) { + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { if (nsURI == FOElementMapping.URI) { if (!localName.equals("single-page-master-reference") && !localName.equals("repeatable-page-master-reference") @@ -79,7 +81,7 @@ public class PageSequenceMaster extends FObj { } } - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { if (childNodes == null) { missingChildElementError("(single-page-master-reference|" + "repeatable-page-master-reference|repeatable-page-master-alternatives)+"); diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java index 31ac2eb13..ef37d1e9c 100644 --- a/src/java/org/apache/fop/fo/pagination/Region.java +++ b/src/java/org/apache/fop/fo/pagination/Region.java @@ -23,7 +23,9 @@ import java.awt.Rectangle; // XML import org.xml.sax.Attributes; import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; +// FOP import org.apache.fop.apps.FOPException; import org.apache.fop.datatypes.FODimension; import org.apache.fop.fo.FONode; @@ -68,8 +70,9 @@ public abstract class Region extends FObj { * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL/FOP Content Model: empty */ - protected void validateChildNode(Locator loc, String nsURI, String localName) { - invalidChildError(loc, nsURI, localName); + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { + invalidChildError(loc, nsURI, localName); } /** diff --git a/src/java/org/apache/fop/fo/pagination/RegionBA.java b/src/java/org/apache/fop/fo/pagination/RegionBA.java index 6498b3cc2..9f8bfb39f 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBA.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBA.java @@ -21,6 +21,9 @@ package org.apache.fop.fo.pagination; // Java import java.awt.Rectangle; +// XML +import org.xml.sax.SAXParseException; + // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FOTreeVisitor; @@ -50,7 +53,7 @@ public abstract class RegionBA extends RegionBASE { /** * @see org.apache.fop.fo.FONode#endOfNode() */ - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { super.endOfNode(); bPrecedence = (this.propertyList.get(PR_PRECEDENCE).getEnum() == Precedence.TRUE); diff --git a/src/java/org/apache/fop/fo/pagination/RegionBASE.java b/src/java/org/apache/fop/fo/pagination/RegionBASE.java index c98741d04..08b662d19 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBASE.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBASE.java @@ -20,6 +20,7 @@ package org.apache.fop.fo.pagination; // XML import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; @@ -43,7 +44,7 @@ public abstract class RegionBASE extends Region { /** * @see org.apache.fop.fo.FONode#endOfNode() */ - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { // The problem with this is that it might not be known yet.... // Supposing extent is calculated in terms of percentage this.extent = this.propertyList.get(PR_EXTENT).getLength().getValue(); diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java index 0dc9b1268..5d3e4a70c 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java +++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java @@ -24,6 +24,7 @@ import java.util.ArrayList; // XML import org.xml.sax.Attributes; import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FOElementMapping; @@ -63,7 +64,8 @@ public class RepeatablePageMasterAlternatives extends FObj * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) XSL/FOP: (conditional-page-master-reference+) */ - protected void validateChildNode(Locator loc, String nsURI, String localName) { + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { if (!(nsURI == FOElementMapping.URI && localName.equals("conditional-page-master-reference"))) { invalidChildError(loc, nsURI, localName); @@ -73,7 +75,7 @@ public class RepeatablePageMasterAlternatives extends FObj /** * @see org.apache.fop.fo.FONode#end */ - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { if (childNodes == null) { missingChildElementError("(conditional-page-master-reference+)"); } diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java index d851f522c..581b54646 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java @@ -21,6 +21,7 @@ package org.apache.fop.fo.pagination; // XML import org.xml.sax.Attributes; import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; @@ -53,7 +54,8 @@ public class RepeatablePageMasterReference extends PageMasterReference * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL/FOP Content Model: empty */ - protected void validateChildNode(Locator loc, String nsURI, String localName) { + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { invalidChildError(loc, nsURI, localName); } diff --git a/src/java/org/apache/fop/fo/pagination/Root.java b/src/java/org/apache/fop/fo/pagination/Root.java index 1b7cd2f7f..ca240f275 100644 --- a/src/java/org/apache/fop/fo/pagination/Root.java +++ b/src/java/org/apache/fop/fo/pagination/Root.java @@ -21,6 +21,10 @@ package org.apache.fop.fo.pagination; // java import java.util.List; +// XML +import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; + // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; @@ -29,7 +33,6 @@ import org.apache.fop.fo.extensions.ExtensionElementMapping; import org.apache.fop.fo.extensions.Bookmarks; import org.apache.fop.fo.FOInputHandler; import org.apache.fop.fo.FOTreeVisitor; -import org.xml.sax.Locator; /** * The fo:root formatting object. Contains page masters, page-sequences. @@ -70,7 +73,8 @@ public class Root extends FObj { XSL 1.0 Spec: (layout-master-set,declarations?,page-sequence+) FOP: (layout-master-set, declarations?, fox:bookmarks?, page-sequence+) */ - protected void validateChildNode(Locator loc, String nsURI, String localName) { + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { if (nsURI == FOElementMapping.URI) { if (localName.equals("layout-master-set")) { if (layoutMasterSet != null) { diff --git a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java index 592c1b498..ac9fa50d8 100644 --- a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java @@ -21,6 +21,7 @@ package org.apache.fop.fo.pagination; // XML import org.xml.sax.Attributes; import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; @@ -51,7 +52,8 @@ public class SinglePageMasterReference extends PageMasterReference * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL/FOP Content Model: empty */ - protected void validateChildNode(Locator loc, String nsURI, String localName) { + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { invalidChildError(loc, nsURI, localName); } diff --git a/src/java/org/apache/fop/fo/pagination/StaticContent.java b/src/java/org/apache/fop/fo/pagination/StaticContent.java index 83a870266..a82721470 100644 --- a/src/java/org/apache/fop/fo/pagination/StaticContent.java +++ b/src/java/org/apache/fop/fo/pagination/StaticContent.java @@ -21,6 +21,7 @@ package org.apache.fop.fo.pagination; // XML import org.xml.sax.Attributes; import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.apps.FOPException; @@ -48,7 +49,8 @@ public class StaticContent extends Flow { * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL/FOP Content Model: (%block;)+ */ - protected void validateChildNode(Locator loc, String nsURI, String localName) { + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { if (!isBlockItem(nsURI, localName)) { invalidChildError(loc, nsURI, localName); } @@ -59,7 +61,7 @@ public class StaticContent extends Flow { * StructureRenderer that we are at the end of the flow. * @see org.apache.fop.fo.FONode#end */ - protected void endOfNode() { + protected void endOfNode() throws SAXParseException { if (childNodes == null) { missingChildElementError("(%block;)+"); } diff --git a/src/java/org/apache/fop/fo/pagination/Title.java b/src/java/org/apache/fop/fo/pagination/Title.java index 5ebc2b144..5e5a8271d 100644 --- a/src/java/org/apache/fop/fo/pagination/Title.java +++ b/src/java/org/apache/fop/fo/pagination/Title.java @@ -21,6 +21,7 @@ package org.apache.fop.fo.pagination; // XML import org.xml.sax.Attributes; import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; // FOP import org.apache.fop.datatypes.ColorType; @@ -54,7 +55,8 @@ public class Title extends FObjMixed { * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) XSL/FOP: (#PCDATA|%inline;)* */ - protected void validateChildNode(Locator loc, String nsURI, String localName) { + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { if (!isInlineItem(nsURI, localName)) { invalidChildError(loc, nsURI, localName); } -- 2.39.5