aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2004-08-01 04:20:50 +0000
committerGlen Mazza <gmazza@apache.org>2004-08-01 04:20:50 +0000
commitaa569d642f3814a7e1242ade45cac003761914e6 (patch)
treee4a744514b1fd1bfd084c1cb0e36381c87dd447a /src
parent07e8b67a4aedd53a69895a82f328b472c9a05a6e (diff)
downloadxmlgraphics-fop-aa569d642f3814a7e1242ade45cac003761914e6.tar.gz
xmlgraphics-fop-aa569d642f3814a7e1242ade45cac003761914e6.zip
1.) Moved from FOPException to SAXParseException for addProperties()
2.) FONode: locator object added, its three components (file, line, col) removed 3.) FONode: new attributeError() method created for attribute problems in input FO. 4.) Removed some setup() methods in the FO's, placed them in addProperties() instead. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197847 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/fo/FONode.java50
-rw-r--r--src/java/org/apache/fop/fo/FOTreeBuilder.java2
-rw-r--r--src/java/org/apache/fop/fo/FObj.java7
-rw-r--r--src/java/org/apache/fop/fo/PropertyList.java3
-rw-r--r--src/java/org/apache/fop/fo/XMLElement.java4
-rw-r--r--src/java/org/apache/fop/fo/XMLObj.java11
-rw-r--r--src/java/org/apache/fop/fo/extensions/Outline.java4
-rw-r--r--src/java/org/apache/fop/fo/extensions/svg/SVGElement.java4
-rw-r--r--src/java/org/apache/fop/fo/flow/BasicLink.java59
-rw-r--r--src/java/org/apache/fop/fo/flow/Block.java105
-rw-r--r--src/java/org/apache/fop/fo/flow/BlockContainer.java4
-rw-r--r--src/java/org/apache/fop/fo/flow/ExternalGraphic.java3
-rw-r--r--src/java/org/apache/fop/fo/flow/Footnote.java3
-rw-r--r--src/java/org/apache/fop/fo/flow/FootnoteBody.java3
-rw-r--r--src/java/org/apache/fop/fo/flow/Inline.java6
-rw-r--r--src/java/org/apache/fop/fo/flow/InlineContainer.java4
-rw-r--r--src/java/org/apache/fop/fo/flow/ListBlock.java65
-rw-r--r--src/java/org/apache/fop/fo/flow/ListItem.java2
-rw-r--r--src/java/org/apache/fop/fo/flow/ListItemLabel.java3
-rw-r--r--src/java/org/apache/fop/fo/flow/Marker.java4
-rw-r--r--src/java/org/apache/fop/fo/flow/PageNumber.java3
-rw-r--r--src/java/org/apache/fop/fo/flow/RetrieveMarker.java3
-rw-r--r--src/java/org/apache/fop/fo/flow/Table.java3
-rw-r--r--src/java/org/apache/fop/fo/flow/TableBody.java5
-rw-r--r--src/java/org/apache/fop/fo/flow/TableCell.java3
-rw-r--r--src/java/org/apache/fop/fo/flow/TableColumn.java3
-rw-r--r--src/java/org/apache/fop/fo/flow/TableRow.java3
-rw-r--r--src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java9
-rw-r--r--src/java/org/apache/fop/fo/pagination/Flow.java13
-rw-r--r--src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java14
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageMasterReference.java10
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageSequence.java11
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java13
-rw-r--r--src/java/org/apache/fop/fo/pagination/Region.java11
-rw-r--r--src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java11
-rw-r--r--src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java7
-rw-r--r--src/java/org/apache/fop/fo/pagination/SimplePageMaster.java15
-rw-r--r--src/java/org/apache/fop/fo/pagination/StaticContent.java7
38 files changed, 185 insertions, 305 deletions
diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java
index 54ffcd6f2..acea124dc 100644
--- a/src/java/org/apache/fop/fo/FONode.java
+++ b/src/java/org/apache/fop/fo/FONode.java
@@ -29,7 +29,6 @@ import org.xml.sax.Locator;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.util.CharUtilities;
import org.apache.fop.fo.extensions.ExtensionElementMapping;
@@ -47,14 +46,12 @@ public abstract class FONode {
/** Parent FO node */
protected FONode parent;
- /** Marks input file containing this object **/
- public String systemId;
-
- /** Marks line number of this object in the input file **/
- public int line;
-
- /** Marks column number of this object in the input file **/
- public int column;
+ /** Marks location of this object from the input FO
+ * Call locator.getSystemId(), getLineNumber(),
+ * getColumnNumber() for file, line, column
+ * information
+ */
+ public Locator locator;
/** Logger for fo-tree related messages **/
private static Log log = LogFactory.getLog(FONode.class);
@@ -73,9 +70,7 @@ public abstract class FONode {
*/
public void setLocation(Locator locator) {
if (locator != null) {
- line = locator.getLineNumber();
- column = locator.getColumnNumber();
- systemId = locator.getSystemId();
+ this.locator = locator;
}
}
@@ -111,9 +106,9 @@ public abstract class FONode {
* @param elementName element name (e.g., "fo:block")
* @param locator Locator object (ignored by default)
* @param attlist Collection of attributes passed to us from the parser.
- * @throws FOPException for errors or inconsistencies in the attributes
+ * @throws SAXParseException for errors or inconsistencies in the attributes
*/
- public void processNode(String elementName, Locator locator, Attributes attlist) throws FOPException {
+ public void processNode(String elementName, Locator locator, Attributes attlist) throws SAXParseException {
System.out.println("name = " + elementName);
}
@@ -240,6 +235,18 @@ 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 attributeError(String problem)
+ throws SAXParseException {
+ throw new SAXParseException (errorText(locator) + getName() + ", " +
+ problem, locator);
+ }
+
+ /**
+ * Helper function to standardize "too many" error exceptions
+ * (e.g., two fo:declarations within fo:root)
+ * @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)
throws SAXParseException {
throw new SAXParseException (errorText(loc) + getName() + ", only one "
@@ -280,9 +287,9 @@ public abstract class FONode {
*/
protected void missingChildElementError(String contentModel)
throws SAXParseException {
- throw new SAXParseException(errorText(line, column) + getName() +
+ throw new SAXParseException(errorText(locator) + getName() +
" is missing child elements. \nRequired Content Model: "
- + contentModel, null, null, line, column);
+ + contentModel, locator);
}
/**
@@ -298,16 +305,5 @@ public abstract class FONode {
return "Error(" + loc.getLineNumber() + "/" + loc.getColumnNumber() + "): ";
}
}
-
- /**
- * Helper function to return "Error (line#/column#)" string for
- * above exception messages
- * @param lineNumber - line number of node with error
- * @param columnNumber - column number of node with error
- * @return String opening error text
- */
- protected static String errorText(int lineNumber, int columnNumber) {
- return "Error(" + lineNumber + "/" + columnNumber + "): ";
- }
}
diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java
index 9fbdbab49..97cbe637e 100644
--- a/src/java/org/apache/fop/fo/FOTreeBuilder.java
+++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java
@@ -268,8 +268,6 @@ public class FOTreeBuilder extends DefaultHandler {
foNode.processNode(localName, locator, attlist);
} catch (IllegalArgumentException e) {
throw new SAXException(e);
- } catch (FOPException e) {
- throw new SAXException(e);
}
if (rootFObj == null) {
diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java
index 702a78683..a9272333b 100644
--- a/src/java/org/apache/fop/fo/FObj.java
+++ b/src/java/org/apache/fop/fo/FObj.java
@@ -25,13 +25,14 @@ import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.flow.Marker;
import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.PropertyMaker;
import org.apache.fop.layoutmgr.AddLMVisitor;
+
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
+import org.xml.sax.SAXParseException;
/**
* Base class for representation of formatting objects and their processing.
@@ -98,7 +99,7 @@ public class FObj extends FONode implements Constants {
* @see org.apache.fop.fo.FONode#processNode
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist) throws FOPException {
+ Attributes attlist) throws SAXParseException {
setLocation(locator);
addProperties(attlist);
}
@@ -107,7 +108,7 @@ public class FObj extends FONode implements Constants {
* Set properties for this FO based on node attributes
* @param attlist Collection of attributes passed to us from the parser.
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
FObj parentFO = findNearestAncestorFObj();
PropertyList parentPL = null;
diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/java/org/apache/fop/fo/PropertyList.java
index 39ce8a7f1..e15374156 100644
--- a/src/java/org/apache/fop/fo/PropertyList.java
+++ b/src/java/org/apache/fop/fo/PropertyList.java
@@ -422,8 +422,7 @@ public class PropertyList extends HashMap {
* @param attributes Collection of attributes passed to us from the parser.
* @throws FOPException If an error occurs while building the PropertyList
*/
- public void addAttributesToList(Attributes attributes)
- throws FOPException {
+ public void addAttributesToList(Attributes attributes) {
/*
* If font-size is set on this FO, must set it first, since
* other attributes specified in terms of "ems" depend on it.
diff --git a/src/java/org/apache/fop/fo/XMLElement.java b/src/java/org/apache/fop/fo/XMLElement.java
index 360b5f49c..accd4f45a 100644
--- a/src/java/org/apache/fop/fo/XMLElement.java
+++ b/src/java/org/apache/fop/fo/XMLElement.java
@@ -21,9 +21,9 @@ package org.apache.fop.fo;
// 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.layoutmgr.AddLMVisitor;
/**
@@ -46,7 +46,7 @@ public class XMLElement extends XMLObj {
* @see org.apache.fop.fo.FONode#processNode
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist) throws FOPException {
+ Attributes attlist) throws SAXParseException {
super.processNode(elementName, locator, attlist);
init();
}
diff --git a/src/java/org/apache/fop/fo/XMLObj.java b/src/java/org/apache/fop/fo/XMLObj.java
index f74607245..f48d2077f 100644
--- a/src/java/org/apache/fop/fo/XMLObj.java
+++ b/src/java/org/apache/fop/fo/XMLObj.java
@@ -26,10 +26,10 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
+import org.xml.sax.SAXParseException;
import javax.xml.parsers.DocumentBuilderFactory;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.layoutmgr.AddLMVisitor;
/**
@@ -61,10 +61,11 @@ public abstract class XMLObj extends FONode {
/**
* @see org.apache.fop.fo.FONode#processNode
*/
- public void processNode(String elementName, Locator locator, Attributes attlist) throws FOPException {
- setLocation(locator);
- name = elementName;
- attr = attlist;
+ public void processNode(String elementName, Locator locator,
+ Attributes attlist) throws SAXParseException {
+ setLocation(locator);
+ name = elementName;
+ attr = attlist;
}
/**
diff --git a/src/java/org/apache/fop/fo/extensions/Outline.java b/src/java/org/apache/fop/fo/extensions/Outline.java
index 3d5e5f6b5..d3e293306 100644
--- a/src/java/org/apache/fop/fo/extensions/Outline.java
+++ b/src/java/org/apache/fop/fo/extensions/Outline.java
@@ -20,11 +20,11 @@ package org.apache.fop.fo.extensions;
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
import java.util.ArrayList;
import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
/**
@@ -53,7 +53,7 @@ public class Outline extends ExtensionObj {
*
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
internalDestination =
attlist.getValue("internal-destination");
externalDestination =
diff --git a/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java b/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
index 883c90a27..6c0d4718e 100644
--- a/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
+++ b/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
@@ -21,7 +21,6 @@ package org.apache.fop.fo.extensions.svg;
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
import org.apache.batik.dom.svg.SVGOMDocument;
import org.apache.batik.dom.svg.SVGOMElement;
@@ -31,6 +30,7 @@ import org.w3c.dom.Element;
import org.w3c.dom.svg.SVGDocument;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
+import org.xml.sax.SAXParseException;
import org.apache.batik.bridge.UnitProcessor;
import org.apache.batik.util.SVGConstants;
@@ -62,7 +62,7 @@ public class SVGElement extends SVGObj {
* @see org.apache.fop.fo.FONode#processNode
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist) throws FOPException {
+ Attributes attlist) throws SAXParseException {
super.processNode(elementName, locator, attlist);
init();
}
diff --git a/src/java/org/apache/fop/fo/flow/BasicLink.java b/src/java/org/apache/fop/fo/flow/BasicLink.java
index 4a4821bd7..89fbc7e0b 100644
--- a/src/java/org/apache/fop/fo/flow/BasicLink.java
+++ b/src/java/org/apache/fop/fo/flow/BasicLink.java
@@ -24,7 +24,6 @@ import org.xml.sax.Locator;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
@@ -57,8 +56,25 @@ public class BasicLink extends Inline {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
+
+ setupID();
+ String ext = propertyList.get(PR_EXTERNAL_DESTINATION).getString();
+ String internal = propertyList.get(PR_INTERNAL_DESTINATION).getString();
+
+ // per spec, internal takes precedence if both specified
+ if (internal.length() > 0) {
+ link = internal;
+ } else if (ext.length() > 0) {
+ link = ext;
+ external = true;
+ } else {
+ // slightly stronger than spec "should be specified"
+ attributeError("Missing attribute: Either external-destination or " +
+ "internal-destination must be specified.");
+ }
+
getFOInputHandler().startLink(this);
}
@@ -106,44 +122,6 @@ public class BasicLink extends Inline {
}
/**
- * @todo check if needed; not being called currently
- */
- private void setup() {
- String destination;
- int linkType;
-
- // Common Accessibility Properties
- CommonAccessibility mAccProps = propMgr.getAccessibilityProps();
-
- // Common Aural Properties
- CommonAural mAurProps = propMgr.getAuralProps();
-
- // Common Border, Padding, and Background Properties
- CommonBorderAndPadding bap = propMgr.getBorderAndPadding();
- CommonBackground bProps = propMgr.getBackgroundProps();
-
- // Common Margin Properties-Inline
- CommonMarginInline mProps = propMgr.getMarginInlineProps();
-
- // Common Relative Position Properties
- CommonRelativePosition mRelProps = propMgr.getRelativePositionProps();
-
- String ext = propertyList.get(PR_EXTERNAL_DESTINATION).getString();
- setupID();
-
- String internal = propertyList.get(PR_INTERNAL_DESTINATION).getString();
-
- if (ext.length() > 0) {
- link = ext;
- external = true;
- } else if (internal.length() > 0) {
- link = internal;
- } else {
- getLogger().error("basic-link requires an internal or external destination");
- }
- }
-
- /**
* @return true (BasicLink can contain Markers)
*/
protected boolean containsMarkers() {
@@ -156,7 +134,6 @@ public class BasicLink extends Inline {
* @param aLMV the AddLMVisitor object that can access this object.
*/
public void acceptVisitor(AddLMVisitor aLMV) {
- setup();
aLMV.serveBasicLink(this);
}
}
diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java
index 06ff3b5c6..69131a5be 100644
--- a/src/java/org/apache/fop/fo/flow/Block.java
+++ b/src/java/org/apache/fop/fo/flow/Block.java
@@ -24,7 +24,6 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.CharIterator;
import org.apache.fop.fo.FONode;
@@ -100,7 +99,7 @@ public class Block extends FObjMixed {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
this.span = this.propertyList.get(PR_SPAN).getEnum();
this.wsTreatment =
@@ -112,89 +111,33 @@ public class Block extends FObjMixed {
this.propertyList.get(PR_LINEFEED_TREATMENT).getEnum();
setupID();
+ this.align = this.propertyList.get(PR_TEXT_ALIGN).getEnum();
+ this.alignLast =
+ this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum();
+ this.breakAfter = this.propertyList.get(PR_BREAK_AFTER).getEnum();
+ this.lineHeight = this.propertyList.get(
+ PR_LINE_HEIGHT).getLength().getValue();
+ this.startIndent = this.propertyList.get(
+ PR_START_INDENT).getLength().getValue();
+ this.endIndent = this.propertyList.get(
+ PR_END_INDENT).getLength().getValue();
+ this.spaceBefore = this.propertyList.get(
+ PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue();
+ this.spaceAfter = this.propertyList.get(
+ PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue();
+ this.textIndent = this.propertyList.get(
+ PR_TEXT_INDENT).getLength().getValue();
+ this.keepWithNext =
+ this.propertyList.get(PR_KEEP_WITH_NEXT).getEnum();
+
+ this.blockWidows =
+ this.propertyList.get(PR_WIDOWS).getNumber().intValue();
+ this.blockOrphans =
+ this.propertyList.get(PR_ORPHANS).getNumber().intValue();
getFOInputHandler().startBlock(this);
}
- private void setup() {
-
- // Common Accessibility Properties
- CommonAccessibility mAccProps = propMgr.getAccessibilityProps();
-
- // Common Aural Properties
- CommonAural mAurProps = propMgr.getAuralProps();
-
- // Common Border, Padding, and Background Properties
- CommonBorderAndPadding bap = propMgr.getBorderAndPadding();
- CommonBackground bProps = propMgr.getBackgroundProps();
-
- // Common Font Properties
- //this.fontState = propMgr.getFontState(area.getFontInfo());
-
- // Common Hyphenation Properties
- CommonHyphenation mHyphProps = propMgr.getHyphenationProps();
-
- // Common Margin Properties-Block
- CommonMarginBlock mProps = propMgr.getMarginProps();
-
- // Common Relative Position Properties
- CommonRelativePosition mRelProps =
- propMgr.getRelativePositionProps();
-
- // this.propertyList.get("break-after");
- // this.propertyList.get("break-before");
- // this.propertyList.get("color");
- // this.propertyList.get("text-depth");
- // this.propertyList.get("text-altitude");
- // this.propertyList.get("hyphenation-keep");
- // this.propertyList.get("hyphenation-ladder-count");
- setupID();
- // this.propertyList.get("keep-together");
- // this.propertyList.get("keep-with-next");
- // this.propertyList.get("keep-with-previous");
- // this.propertyList.get("last-line-end-indent");
- // this.propertyList.get("linefeed-treatment");
- // this.propertyList.get("line-height");
- // this.propertyList.get("line-height-shift-adjustment");
- // this.propertyList.get("line-stacking-strategy");
- // this.propertyList.get("orphans");
- // this.propertyList.get("white-space-treatment");
- // this.propertyList.get("span");
- // this.propertyList.get("text-align");
- // this.propertyList.get("text-align-last");
- // this.propertyList.get("text-indent");
- // this.propertyList.get("visibility");
- // this.propertyList.get("white-space-collapse");
- // this.propertyList.get("widows");
- // this.propertyList.get("wrap-option");
- // this.propertyList.get("z-index");
-
- this.align = this.propertyList.get(PR_TEXT_ALIGN).getEnum();
- this.alignLast =
- this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum();
- this.breakAfter = this.propertyList.get(PR_BREAK_AFTER).getEnum();
- this.lineHeight = this.propertyList.get(
- PR_LINE_HEIGHT).getLength().getValue();
- this.startIndent = this.propertyList.get(
- PR_START_INDENT).getLength().getValue();
- this.endIndent = this.propertyList.get(
- PR_END_INDENT).getLength().getValue();
- this.spaceBefore = this.propertyList.get(
- PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue();
- this.spaceAfter = this.propertyList.get(
- PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue();
- this.textIndent = this.propertyList.get(
- PR_TEXT_INDENT).getLength().getValue();
- this.keepWithNext =
- this.propertyList.get(PR_KEEP_WITH_NEXT).getEnum();
-
- this.blockWidows =
- this.propertyList.get(PR_WIDOWS).getNumber().intValue();
- this.blockOrphans =
- this.propertyList.get(PR_ORPHANS).getNumber().intValue();
-
- }
-
/**
* @return true (Block can contain Markers)
*/
diff --git a/src/java/org/apache/fop/fo/flow/BlockContainer.java b/src/java/org/apache/fop/fo/flow/BlockContainer.java
index 51bef9036..29adbbe7e 100644
--- a/src/java/org/apache/fop/fo/flow/BlockContainer.java
+++ b/src/java/org/apache/fop/fo/flow/BlockContainer.java
@@ -19,7 +19,6 @@
package org.apache.fop.fo.flow;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
@@ -30,6 +29,7 @@ import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
/**
* Class modelling the fo:block-container object. See Sec. 6.5.3 of the XSL-FO
@@ -59,7 +59,7 @@ public class BlockContainer extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
this.span = this.propertyList.get(PR_SPAN).getEnum();
setupID();
diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
index d1c66374d..3c12b7899 100644
--- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
+++ b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
@@ -26,7 +26,6 @@ import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import org.xml.sax.SAXParseException;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
@@ -75,7 +74,7 @@ public class ExternalGraphic extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
getFOInputHandler().image(this);
}
diff --git a/src/java/org/apache/fop/fo/flow/Footnote.java b/src/java/org/apache/fop/fo/flow/Footnote.java
index df36b7724..f234927e9 100644
--- a/src/java/org/apache/fop/fo/flow/Footnote.java
+++ b/src/java/org/apache/fop/fo/flow/Footnote.java
@@ -24,7 +24,6 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.fo.FObj;
@@ -48,7 +47,7 @@ public class Footnote extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
getFOInputHandler().startFootnote(this);
}
diff --git a/src/java/org/apache/fop/fo/flow/FootnoteBody.java b/src/java/org/apache/fop/fo/flow/FootnoteBody.java
index 413a6bda4..1674ecc31 100644
--- a/src/java/org/apache/fop/fo/flow/FootnoteBody.java
+++ b/src/java/org/apache/fop/fo/flow/FootnoteBody.java
@@ -24,7 +24,6 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
@@ -52,7 +51,7 @@ public class FootnoteBody extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
getFOInputHandler().startFootnoteBody(this);
}
diff --git a/src/java/org/apache/fop/fo/flow/Inline.java b/src/java/org/apache/fop/fo/flow/Inline.java
index b60c20141..adb33d0d1 100644
--- a/src/java/org/apache/fop/fo/flow/Inline.java
+++ b/src/java/org/apache/fop/fo/flow/Inline.java
@@ -59,12 +59,12 @@ public class Inline extends FObjMixed {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
if (parent.getName().equals("fo:flow")) {
- throw new FOPException("inline formatting objects cannot"
- + " be directly under flow");
+ throw new SAXParseException("inline formatting objects cannot"
+ + " be directly under flow", locator);
}
// Common Accessibility Properties
diff --git a/src/java/org/apache/fop/fo/flow/InlineContainer.java b/src/java/org/apache/fop/fo/flow/InlineContainer.java
index a58135351..050507da4 100644
--- a/src/java/org/apache/fop/fo/flow/InlineContainer.java
+++ b/src/java/org/apache/fop/fo/flow/InlineContainer.java
@@ -20,12 +20,12 @@ package org.apache.fop.fo.flow;
// XML
import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginInline;
@@ -47,7 +47,7 @@ public class InlineContainer extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
// Common Border, Padding, and Background Properties
CommonBorderAndPadding bap = propMgr.getBorderAndPadding();
diff --git a/src/java/org/apache/fop/fo/flow/ListBlock.java b/src/java/org/apache/fop/fo/flow/ListBlock.java
index 6f76e4ebc..d36b3c72a 100644
--- a/src/java/org/apache/fop/fo/flow/ListBlock.java
+++ b/src/java/org/apache/fop/fo/flow/ListBlock.java
@@ -23,7 +23,6 @@ import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
@@ -63,56 +62,28 @@ public class ListBlock extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
+ setupID();
+
+ this.align = this.propertyList.get(PR_TEXT_ALIGN).getEnum();
+ this.alignLast = this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum();
+ this.lineHeight =
+ this.propertyList.get(PR_LINE_HEIGHT).getLength().getValue();
+ this.startIndent =
+ this.propertyList.get(PR_START_INDENT).getLength().getValue();
+ this.endIndent =
+ this.propertyList.get(PR_END_INDENT).getLength().getValue();
+ this.spaceBefore =
+ this.propertyList.get(PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue();
+ this.spaceAfter =
+ this.propertyList.get(PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue();
+ this.spaceBetweenListRows = 0; // not used at present
+ this.backgroundColor =
+ this.propertyList.get(PR_BACKGROUND_COLOR).getColorType();
getFOInputHandler().startList(this);
}
- private void setup() throws FOPException {
-
- // Common Accessibility Properties
- CommonAccessibility mAccProps = propMgr.getAccessibilityProps();
-
- // Common Aural Properties
- CommonAural mAurProps = propMgr.getAuralProps();
-
- // Common Border, Padding, and Background Properties
- CommonBorderAndPadding bap = propMgr.getBorderAndPadding();
- CommonBackground bProps = propMgr.getBackgroundProps();
-
- // Common Margin Properties-Block
- CommonMarginBlock mProps = propMgr.getMarginProps();
-
- // Common Relative Position Properties
- CommonRelativePosition mRelProps = propMgr.getRelativePositionProps();
-
- // this.propertyList.get("break-after");
- // this.propertyList.get("break-before");
- setupID();
- // this.propertyList.get("keep-together");
- // this.propertyList.get("keep-with-next");
- // this.propertyList.get("keep-with-previous");
- // this.propertyList.get("provisional-distance-between-starts");
- // this.propertyList.get("provisional-label-separation");
-
- this.align = this.propertyList.get(PR_TEXT_ALIGN).getEnum();
- this.alignLast = this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum();
- this.lineHeight =
- this.propertyList.get(PR_LINE_HEIGHT).getLength().getValue();
- this.startIndent =
- this.propertyList.get(PR_START_INDENT).getLength().getValue();
- this.endIndent =
- this.propertyList.get(PR_END_INDENT).getLength().getValue();
- this.spaceBefore =
- this.propertyList.get(PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue();
- this.spaceAfter =
- this.propertyList.get(PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue();
- this.spaceBetweenListRows = 0; // not used at present
- this.backgroundColor =
- this.propertyList.get(PR_BACKGROUND_COLOR).getColorType();
-
- }
-
/**
* @return false (ListBlock does not generate inline areas)
*/
diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/java/org/apache/fop/fo/flow/ListItem.java
index 75a2cd37f..25d753918 100644
--- a/src/java/org/apache/fop/fo/flow/ListItem.java
+++ b/src/java/org/apache/fop/fo/flow/ListItem.java
@@ -63,7 +63,7 @@ public class ListItem extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
getFOInputHandler().startListItem(this);
}
diff --git a/src/java/org/apache/fop/fo/flow/ListItemLabel.java b/src/java/org/apache/fop/fo/flow/ListItemLabel.java
index 24146d539..81b631282 100644
--- a/src/java/org/apache/fop/fo/flow/ListItemLabel.java
+++ b/src/java/org/apache/fop/fo/flow/ListItemLabel.java
@@ -23,7 +23,6 @@ import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
@@ -45,7 +44,7 @@ public class ListItemLabel extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
getFOInputHandler().startListLabel();
}
diff --git a/src/java/org/apache/fop/fo/flow/Marker.java b/src/java/org/apache/fop/fo/flow/Marker.java
index bfcbf7250..a090d78fc 100644
--- a/src/java/org/apache/fop/fo/flow/Marker.java
+++ b/src/java/org/apache/fop/fo/flow/Marker.java
@@ -20,9 +20,9 @@ package org.apache.fop.fo.flow;
// XML
import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.layoutmgr.AddLMVisitor;
@@ -48,7 +48,7 @@ public class Marker extends FObjMixed {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
this.markerClassName =
this.propertyList.get(PR_MARKER_CLASS_NAME).getString();
diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java
index 7df1350a5..ba8e4327b 100644
--- a/src/java/org/apache/fop/fo/flow/PageNumber.java
+++ b/src/java/org/apache/fop/fo/flow/PageNumber.java
@@ -24,7 +24,6 @@ import org.xml.sax.Locator;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
@@ -69,7 +68,7 @@ public class PageNumber extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
setup();
getFOInputHandler().startPageNumber(this);
diff --git a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
index e023f96cd..3ae22e385 100644
--- a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
+++ b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
@@ -24,7 +24,6 @@ import org.xml.sax.Locator;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.layoutmgr.AddLMVisitor;
@@ -61,7 +60,7 @@ public class RetrieveMarker extends FObjMixed {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
this.retrieveClassName =
this.propertyList.get(PR_RETRIEVE_CLASS_NAME).getString();
diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java
index 5babb90bb..55b0a7abf 100644
--- a/src/java/org/apache/fop/fo/flow/Table.java
+++ b/src/java/org/apache/fop/fo/flow/Table.java
@@ -26,7 +26,6 @@ import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
@@ -79,7 +78,7 @@ public class Table extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
setupID();
getFOInputHandler().startTable(this);
diff --git a/src/java/org/apache/fop/fo/flow/TableBody.java b/src/java/org/apache/fop/fo/flow/TableBody.java
index 8f6197d17..4aa034b11 100644
--- a/src/java/org/apache/fop/fo/flow/TableBody.java
+++ b/src/java/org/apache/fop/fo/flow/TableBody.java
@@ -24,7 +24,6 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
@@ -56,13 +55,13 @@ public class TableBody extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
setupID();
getFOInputHandler().startBody(this);
}
- private void setup() throws FOPException {
+ private void setup() {
// Common Accessibility Properties
CommonAccessibility mAccProps = propMgr.getAccessibilityProps();
diff --git a/src/java/org/apache/fop/fo/flow/TableCell.java b/src/java/org/apache/fop/fo/flow/TableCell.java
index dd06524b6..412fdc02a 100644
--- a/src/java/org/apache/fop/fo/flow/TableCell.java
+++ b/src/java/org/apache/fop/fo/flow/TableCell.java
@@ -24,7 +24,6 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
@@ -122,7 +121,7 @@ public class TableCell extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
doSetup(); // init some basic property values
getFOInputHandler().startCell(this);
diff --git a/src/java/org/apache/fop/fo/flow/TableColumn.java b/src/java/org/apache/fop/fo/flow/TableColumn.java
index 936cdddb7..172b15475 100644
--- a/src/java/org/apache/fop/fo/flow/TableColumn.java
+++ b/src/java/org/apache/fop/fo/flow/TableColumn.java
@@ -24,7 +24,6 @@ import org.xml.sax.Locator;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
@@ -68,7 +67,7 @@ public class TableColumn extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
initialize(); // init some basic property values
getFOInputHandler().startColumn(this);
diff --git a/src/java/org/apache/fop/fo/flow/TableRow.java b/src/java/org/apache/fop/fo/flow/TableRow.java
index 71c89590d..54db3cd6a 100644
--- a/src/java/org/apache/fop/fo/flow/TableRow.java
+++ b/src/java/org/apache/fop/fo/flow/TableRow.java
@@ -23,7 +23,6 @@ import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.KeepValue;
import org.apache.fop.fo.FONode;
@@ -66,7 +65,7 @@ public class TableRow extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
setupID();
getFOInputHandler().startRow(this);
diff --git a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
index 02c9e4fca..3d3c42576 100644
--- a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
+++ b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
@@ -27,7 +27,6 @@ import org.xml.sax.SAXParseException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
/**
* A conditional-page-master-reference formatting object.
@@ -66,7 +65,7 @@ public class ConditionalPageMasterReference extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
if (getProperty(PR_MASTER_REFERENCE) != null) {
setMasterName(getProperty(PR_MASTER_REFERENCE).getString());
@@ -156,7 +155,7 @@ public class ConditionalPageMasterReference extends FObj {
* @param parent parent node
* @throws FOPException If the parent is invalid
*/
- protected void validateParent(FONode parent) throws FOPException {
+ protected void validateParent(FONode parent) throws SAXParseException {
if (parent.getName().equals("fo:repeatable-page-master-alternatives")) {
this.repeatablePageMasterAlternatives =
(RepeatablePageMasterAlternatives)parent;
@@ -168,9 +167,9 @@ public class ConditionalPageMasterReference extends FObj {
this.repeatablePageMasterAlternatives.addConditionalPageMasterReference(this);
}
} else {
- throw new FOPException("fo:conditional-page-master-reference must be child "
+ throw new SAXParseException("fo:conditional-page-master-reference must be child "
+ "of fo:repeatable-page-master-alternatives, not "
- + parent.getName());
+ + parent.getName(), locator);
}
}
diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java
index d333d13f2..cbfbecb66 100644
--- a/src/java/org/apache/fop/fo/pagination/Flow.java
+++ b/src/java/org/apache/fop/fo/pagination/Flow.java
@@ -31,7 +31,6 @@ import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
/**
* Class modelling the fo:flow object. See Sec. 6.4.18 in the XSL-FO Standard.
@@ -100,13 +99,13 @@ public class Flow extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
if (parent.getName().equals("fo:page-sequence")) {
this.pageSequence = (PageSequence) parent;
} else {
- throw new FOPException("flow must be child of "
- + "page-sequence, not " + parent.getName());
+ throw new SAXParseException("flow must be child of "
+ + "page-sequence, not " + parent.getName(), locator);
}
// according to communication from Paul Grosso (XSL-List,
// 001228, Number 406), confusion in spec section 6.4.5 about
@@ -134,10 +133,10 @@ public class Flow extends FObj {
* @param name the name of the flow to set
* @throws FOPException for an empty name
*/
- protected void setFlowName(String name) throws FOPException {
+ protected void setFlowName(String name) throws SAXParseException {
if (name == null || name.equals("")) {
- throw new FOPException("A 'flow-name' is required for "
- + getName());
+ throw new SAXParseException("A 'flow-name' is required for "
+ + getName(), locator);
} else {
flowName = name;
}
diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
index 94303e466..356ecc71d 100644
--- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
+++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
@@ -83,15 +83,15 @@ public class LayoutMasterSet extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
if (parent.getName().equals("fo:root")) {
Root root = (Root)parent;
root.setLayoutMasterSet(this);
} else {
- throw new FOPException("fo:layout-master-set must be child of fo:root, not "
- + parent.getName());
+ throw new SAXParseException("fo:layout-master-set must be child of fo:root, not "
+ + parent.getName(), locator);
}
this.simplePageMasters = new java.util.HashMap();
@@ -170,9 +170,9 @@ public class LayoutMasterSet extends FObj {
/**
* Section 7.25.7: check to see that if a region-name is a
* duplicate, that it maps to the same fo region-class.
- * @throws FOPException if there's a name duplication
+ * @throws SAXParseException if there's a name duplication
*/
- public void checkRegionNames() throws FOPException {
+ public void checkRegionNames() throws SAXParseException {
// (user-entered) region-name to default region map.
Map allRegions = new java.util.HashMap();
for (Iterator spm = simplePageMasters.values().iterator();
@@ -187,13 +187,13 @@ public class LayoutMasterSet extends FObj {
String defaultRegionName =
(String) allRegions.get(region.getRegionName());
if (!defaultRegionName.equals(region.getDefaultRegionName())) {
- throw new FOPException("Region-name ("
+ throw new SAXParseException("Region-name ("
+ region.getRegionName()
+ ") is being mapped to multiple "
+ "region-classes ("
+ defaultRegionName + " and "
+ region.getDefaultRegionName()
- + ")");
+ + ")", locator);
}
}
allRegions.put(region.getRegionName(),
diff --git a/src/java/org/apache/fop/fo/pagination/PageMasterReference.java b/src/java/org/apache/fop/fo/pagination/PageMasterReference.java
index 2b6426c6d..3e7c971a3 100644
--- a/src/java/org/apache/fop/fo/pagination/PageMasterReference.java
+++ b/src/java/org/apache/fop/fo/pagination/PageMasterReference.java
@@ -20,11 +20,11 @@ package org.apache.fop.fo.pagination;
// SAX
import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.layoutmgr.AddLMVisitor;
/**
@@ -46,7 +46,7 @@ public abstract class PageMasterReference extends FObj
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
if (getProperty(PR_MASTER_REFERENCE) != null) {
this.masterName = getProperty(PR_MASTER_REFERENCE).getString();
@@ -69,7 +69,7 @@ public abstract class PageMasterReference extends FObj
* @param parent parent node
* @throws FOPException If the parent is invalid.
*/
- protected void validateParent(FONode parent) throws FOPException {
+ protected void validateParent(FONode parent) throws SAXParseException {
if (parent.getName().equals("fo:page-sequence-master")) {
PageSequenceMaster pageSequenceMaster = (PageSequenceMaster)parent;
@@ -80,9 +80,9 @@ public abstract class PageMasterReference extends FObj
pageSequenceMaster.addSubsequenceSpecifier(this);
}
} else {
- throw new FOPException(getName() + " must be"
+ throw new SAXParseException(getName() + " must be"
+ "child of fo:page-sequence-master, not "
- + parent.getName());
+ + parent.getName(), locator);
}
}
diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java
index 3e37adcf5..9f1a7ee3d 100644
--- a/src/java/org/apache/fop/fo/pagination/PageSequence.java
+++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java
@@ -27,6 +27,7 @@ import org.xml.sax.Locator;
import org.xml.sax.SAXParseException;
// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOElementMapping;
@@ -230,7 +231,7 @@ public class PageSequence extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
this.root = (Root) parent;
@@ -258,8 +259,8 @@ public class PageSequence extends FObj {
int pageStart = new Integer(ipnValue).intValue();
this.explicitFirstNumber = (pageStart > 0) ? pageStart : 1;
} catch (NumberFormatException nfe) {
- throw new FOPException("\"" + ipnValue
- + "\" is not a valid value for initial-page-number");
+ throw new SAXParseException("\"" + ipnValue
+ + "\" is not a valid value for initial-page-number", locator);
}
}
@@ -270,9 +271,9 @@ public class PageSequence extends FObj {
this.pageSequenceMaster =
this.layoutMasterSet.getPageSequenceMaster(masterName);
if (this.pageSequenceMaster == null) {
- throw new FOPException("master-reference '" + masterName
+ throw new SAXParseException("master-reference '" + masterName
+ "' for fo:page-sequence matches no"
- + " simple-page-master or page-sequence-master");
+ + " simple-page-master or page-sequence-master", locator);
}
}
diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
index ecb542ef5..cc746780d 100644
--- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
+++ b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
@@ -92,7 +92,7 @@ public class PageSequenceMaster extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
subSequenceSpecifiers = new java.util.ArrayList();
if (parent.getName().equals("fo:layout-master-set")) {
@@ -102,12 +102,17 @@ public class PageSequenceMaster extends FObj {
getLogger().warn("page-sequence-master does not have "
+ "a master-name and so is being ignored");
} else {
- this.layoutMasterSet.addPageSequenceMaster(masterName, this);
+ try {
+ this.layoutMasterSet.addPageSequenceMaster(masterName, this);
+ } catch (Exception e) {
+ throw new SAXParseException("Error with adding Page Sequence Master: "
+ + e.getMessage(), locator);
+ }
}
} else {
- throw new FOPException("fo:page-sequence-master must be child "
+ throw new SAXParseException("fo:page-sequence-master must be child "
+ "of fo:layout-master-set, not "
- + parent.getName());
+ + parent.getName(), locator);
}
}
diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java
index 056a65125..b04c51a29 100644
--- a/src/java/org/apache/fop/fo/pagination/Region.java
+++ b/src/java/org/apache/fop/fo/pagination/Region.java
@@ -26,7 +26,6 @@ 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;
import org.apache.fop.layoutmgr.AddLMVisitor;
@@ -78,7 +77,7 @@ public abstract class Region extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
// regions may have name, or default
@@ -91,18 +90,18 @@ public abstract class Region extends FObj {
// check that name is OK. Not very pretty.
if (isReserved(getRegionName())
&& !getRegionName().equals(getDefaultRegionName())) {
- throw new FOPException("region-name '" + regionName
+ throw new SAXParseException("region-name '" + regionName
+ "' for " + this.getName()
- + " not permitted.");
+ + " not permitted.", locator);
}
}
if (parent instanceof SimplePageMaster) {
layoutMaster = (SimplePageMaster)parent;
} else {
- throw new FOPException(this.getName() + " must be child "
+ throw new SAXParseException(this.getName() + " must be child "
+ "of simple-page-master, not "
- + parent.getName());
+ + parent.getName(), locator);
}
this.wm = this.propertyList.get(PR_WRITING_MODE).getEnum();
diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
index f43f3f5ae..9dde9b90f 100644
--- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
+++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
@@ -31,7 +31,6 @@ import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
/**
* A repeatable-page-master-alternatives formatting object.
@@ -84,7 +83,7 @@ public class RepeatablePageMasterAlternatives extends FObj
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
conditionalPageMasterRefs = new ArrayList();
@@ -92,9 +91,9 @@ public class RepeatablePageMasterAlternatives extends FObj
PageSequenceMaster pageSequenceMaster = (PageSequenceMaster)parent;
pageSequenceMaster.addSubsequenceSpecifier(this);
} else {
- throw new FOPException("fo:repeatable-page-master-alternatives "
+ throw new SAXParseException("fo:repeatable-page-master-alternatives "
+ "must be child of fo:page-sequence-master, not "
- + parent.getName());
+ + parent.getName(), locator);
}
String mr = getProperty(PR_MAXIMUM_REPEATS).getString();
@@ -109,8 +108,8 @@ public class RepeatablePageMasterAlternatives extends FObj
this.maximumRepeats = 0;
}
} catch (NumberFormatException nfe) {
- throw new FOPException("Invalid number for "
- + "'maximum-repeats' property");
+ throw new SAXParseException("Invalid number for "
+ + "'maximum-repeats' property", locator);
}
}
}
diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
index 04f15fdc6..8c0267b84 100644
--- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
+++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
@@ -26,7 +26,6 @@ import org.xml.sax.SAXParseException;
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
/**
* A repeatable-page-master-reference formatting object.
@@ -62,7 +61,7 @@ public class RepeatablePageMasterReference extends PageMasterReference
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
String mr = getProperty(PR_MAXIMUM_REPEATS).getString();
if (mr.equals("no-limit")) {
@@ -76,8 +75,8 @@ public class RepeatablePageMasterReference extends PageMasterReference
this.maximumRepeats = 0;
}
} catch (NumberFormatException nfe) {
- throw new FOPException("Invalid number for "
- + "'maximum-repeats' property");
+ throw new SAXParseException("Invalid number for "
+ + "'maximum-repeats' property", locator);
}
}
}
diff --git a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
index 722ee8cb6..76b422ad6 100644
--- a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
+++ b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
@@ -25,12 +25,12 @@ import java.util.Map;
// XML
import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
/**
* A simple-page-master formatting object.
@@ -55,7 +55,7 @@ public class SimplePageMaster extends FObj {
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
if (parent.getName().equals("fo:layout-master-set")) {
@@ -65,12 +65,17 @@ public class SimplePageMaster extends FObj {
getLogger().warn("simple-page-master does not have "
+ "a master-name and so is being ignored");
} else {
- layoutMasterSet.addSimplePageMaster(this);
+ try {
+ layoutMasterSet.addSimplePageMaster(this);
+ } catch (Exception e) {
+ throw new SAXParseException("Error with adding Page Sequence Master: "
+ + e.getMessage(), locator);
+ }
}
} else {
- throw new FOPException("fo:simple-page-master must be child "
+ throw new SAXParseException("fo:simple-page-master must be child "
+ "of fo:layout-master-set, not "
- + parent.getName());
+ + parent.getName(), locator);
}
//Well, there are only 5 regions so we can save a bit of memory here
regions = new HashMap(5);
diff --git a/src/java/org/apache/fop/fo/pagination/StaticContent.java b/src/java/org/apache/fop/fo/pagination/StaticContent.java
index d0b5ef71c..e1fcbd734 100644
--- a/src/java/org/apache/fop/fo/pagination/StaticContent.java
+++ b/src/java/org/apache/fop/fo/pagination/StaticContent.java
@@ -24,7 +24,6 @@ import org.xml.sax.Locator;
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
@@ -73,10 +72,10 @@ public class StaticContent extends Flow {
* @param name the flow-name to set
* @throws FOPException for a missing flow name
*/
- protected void setFlowName(String name) throws FOPException {
+ protected void setFlowName(String name) throws SAXParseException {
if (name == null || name.equals("")) {
- throw new FOPException("A 'flow-name' is required for "
- + getName() + ".");
+ throw new SAXParseException("A 'flow-name' is required for "
+ + getName() + ".", locator);
} else {
super.setFlowName(name);
}