aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFinn Bock <bckfnn@apache.org>2004-10-28 10:00:25 +0000
committerFinn Bock <bckfnn@apache.org>2004-10-28 10:00:25 +0000
commitb0e76bca6ec366023f5f98d8e07aa77dbfabafe1 (patch)
treeffd62fd750c33c6083daad85feb38a5dbd709de8
parent13fdba00ab86701f8e0b4057ecc5bc36375c8ee0 (diff)
downloadxmlgraphics-fop-b0e76bca6ec366023f5f98d8e07aa77dbfabafe1.tar.gz
xmlgraphics-fop-b0e76bca6ec366023f5f98d8e07aa77dbfabafe1.zip
New exception hierarchy rooted in SAXException and throw clauses on
property parsing and retrieval. PR: 31899 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198106 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--examples/mathml/src/org/apache/fop/mathml/MathMLElement.java4
-rw-r--r--examples/plan/src/org/apache/fop/plan/PlanElement.java4
-rw-r--r--src/java/org/apache/fop/apps/FOPException.java62
-rw-r--r--src/java/org/apache/fop/datatypes/LengthBase.java5
-rw-r--r--src/java/org/apache/fop/datatypes/PercentBase.java4
-rw-r--r--src/java/org/apache/fop/fo/FONode.java59
-rw-r--r--src/java/org/apache/fop/fo/FOPropertyMapping.java3
-rw-r--r--src/java/org/apache/fop/fo/FOText.java3
-rw-r--r--src/java/org/apache/fop/fo/FOTreeBuilder.java19
-rw-r--r--src/java/org/apache/fop/fo/FObj.java19
-rw-r--r--src/java/org/apache/fop/fo/FObjMixed.java6
-rw-r--r--src/java/org/apache/fop/fo/PropertyList.java82
-rwxr-xr-xsrc/java/org/apache/fop/fo/StaticPropertyList.java5
-rwxr-xr-xsrc/java/org/apache/fop/fo/ValidationException.java35
-rw-r--r--src/java/org/apache/fop/fo/XMLObj.java9
-rw-r--r--src/java/org/apache/fop/fo/expr/NumericProperty.java2
-rw-r--r--src/java/org/apache/fop/fo/expr/PropertyException.java25
-rw-r--r--src/java/org/apache/fop/fo/expr/PropertyInfo.java10
-rw-r--r--src/java/org/apache/fop/fo/expr/PropertyParser.java8
-rwxr-xr-xsrc/java/org/apache/fop/fo/expr/RelativeNumericProperty.java4
-rw-r--r--src/java/org/apache/fop/fo/extensions/Bookmarks.java7
-rw-r--r--src/java/org/apache/fop/fo/extensions/ExtensionObj.java6
-rw-r--r--src/java/org/apache/fop/fo/extensions/Outline.java10
-rw-r--r--src/java/org/apache/fop/fo/extensions/svg/SVGElement.java4
-rw-r--r--src/java/org/apache/fop/fo/flow/BasicLink.java13
-rw-r--r--src/java/org/apache/fop/fo/flow/BidiOverride.java9
-rw-r--r--src/java/org/apache/fop/fo/flow/Block.java17
-rw-r--r--src/java/org/apache/fop/fo/flow/BlockContainer.java10
-rw-r--r--src/java/org/apache/fop/fo/flow/Character.java13
-rw-r--r--src/java/org/apache/fop/fo/flow/ExternalGraphic.java11
-rw-r--r--src/java/org/apache/fop/fo/flow/Float.java10
-rw-r--r--src/java/org/apache/fop/fo/flow/Footnote.java13
-rw-r--r--src/java/org/apache/fop/fo/flow/FootnoteBody.java34
-rw-r--r--src/java/org/apache/fop/fo/flow/InitialPropertySet.java14
-rw-r--r--src/java/org/apache/fop/fo/flow/Inline.java13
-rw-r--r--src/java/org/apache/fop/fo/flow/InlineContainer.java15
-rw-r--r--src/java/org/apache/fop/fo/flow/InstreamForeignObject.java15
-rw-r--r--src/java/org/apache/fop/fo/flow/Leader.java9
-rw-r--r--src/java/org/apache/fop/fo/flow/ListBlock.java13
-rw-r--r--src/java/org/apache/fop/fo/flow/ListItem.java13
-rw-r--r--src/java/org/apache/fop/fo/flow/ListItemBody.java11
-rw-r--r--src/java/org/apache/fop/fo/flow/ListItemLabel.java11
-rw-r--r--src/java/org/apache/fop/fo/flow/Marker.java19
-rw-r--r--src/java/org/apache/fop/fo/flow/MultiCase.java9
-rw-r--r--src/java/org/apache/fop/fo/flow/MultiProperties.java12
-rw-r--r--src/java/org/apache/fop/fo/flow/MultiPropertySet.java10
-rw-r--r--src/java/org/apache/fop/fo/flow/MultiSwitch.java12
-rw-r--r--src/java/org/apache/fop/fo/flow/MultiToggle.java3
-rw-r--r--src/java/org/apache/fop/fo/flow/PageNumber.java13
-rw-r--r--src/java/org/apache/fop/fo/flow/PageNumberCitation.java11
-rw-r--r--src/java/org/apache/fop/fo/flow/RetrieveMarker.java13
-rw-r--r--src/java/org/apache/fop/fo/flow/Table.java17
-rw-r--r--src/java/org/apache/fop/fo/flow/TableAndCaption.java12
-rw-r--r--src/java/org/apache/fop/fo/flow/TableBody.java11
-rw-r--r--src/java/org/apache/fop/fo/flow/TableCaption.java12
-rw-r--r--src/java/org/apache/fop/fo/flow/TableCell.java13
-rw-r--r--src/java/org/apache/fop/fo/flow/TableColumn.java12
-rw-r--r--src/java/org/apache/fop/fo/flow/TableRow.java13
-rw-r--r--src/java/org/apache/fop/fo/flow/Wrapper.java9
-rw-r--r--src/java/org/apache/fop/fo/pagination/ColorProfile.java13
-rw-r--r--src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java16
-rw-r--r--src/java/org/apache/fop/fo/pagination/Declarations.java13
-rw-r--r--src/java/org/apache/fop/fo/pagination/Flow.java15
-rw-r--r--src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java33
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageSequence.java23
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java18
-rw-r--r--src/java/org/apache/fop/fo/pagination/Region.java11
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionBA.java7
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionBody.java7
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionSE.java7
-rw-r--r--src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java15
-rw-r--r--src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java10
-rw-r--r--src/java/org/apache/fop/fo/pagination/Root.java13
-rw-r--r--src/java/org/apache/fop/fo/pagination/SimplePageMaster.java13
-rw-r--r--src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java10
-rw-r--r--src/java/org/apache/fop/fo/pagination/StaticContent.java12
-rw-r--r--src/java/org/apache/fop/fo/pagination/Title.java10
-rw-r--r--src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java4
-rw-r--r--src/java/org/apache/fop/fo/properties/BoxPropShorthandParser.java5
-rw-r--r--src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java3
-rw-r--r--src/java/org/apache/fop/fo/properties/CommonAccessibility.java3
-rwxr-xr-xsrc/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java6
-rwxr-xr-xsrc/java/org/apache/fop/fo/properties/CommonFont.java3
-rw-r--r--src/java/org/apache/fop/fo/properties/CommonHyphenation.java3
-rw-r--r--src/java/org/apache/fop/fo/properties/CommonMarginBlock.java3
-rw-r--r--src/java/org/apache/fop/fo/properties/CommonMarginInline.java3
-rw-r--r--src/java/org/apache/fop/fo/properties/CommonRelativePosition.java3
-rw-r--r--src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java24
-rw-r--r--src/java/org/apache/fop/fo/properties/CondLengthProperty.java4
-rw-r--r--src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java3
-rw-r--r--src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java4
-rw-r--r--src/java/org/apache/fop/fo/properties/EnumProperty.java4
-rw-r--r--src/java/org/apache/fop/fo/properties/GenericShorthandParser.java10
-rw-r--r--src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java64
-rw-r--r--src/java/org/apache/fop/fo/properties/KeepProperty.java4
-rw-r--r--src/java/org/apache/fop/fo/properties/LengthPairProperty.java4
-rw-r--r--src/java/org/apache/fop/fo/properties/LengthProperty.java4
-rw-r--r--src/java/org/apache/fop/fo/properties/LengthRangeProperty.java4
-rw-r--r--src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java22
-rw-r--r--src/java/org/apache/fop/fo/properties/PercentLength.java12
-rw-r--r--src/java/org/apache/fop/fo/properties/Property.java4
-rw-r--r--src/java/org/apache/fop/fo/properties/PropertyMaker.java111
-rw-r--r--src/java/org/apache/fop/fo/properties/ShorthandParser.java3
-rw-r--r--src/java/org/apache/fop/fo/properties/SpaceProperty.java4
-rwxr-xr-xsrc/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java4
-rw-r--r--src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java7
106 files changed, 710 insertions, 708 deletions
diff --git a/examples/mathml/src/org/apache/fop/mathml/MathMLElement.java b/examples/mathml/src/org/apache/fop/mathml/MathMLElement.java
index 5167aa0f4..025ed6020 100644
--- a/examples/mathml/src/org/apache/fop/mathml/MathMLElement.java
+++ b/examples/mathml/src/org/apache/fop/mathml/MathMLElement.java
@@ -22,6 +22,7 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.geom.Point2D;
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
@@ -30,7 +31,6 @@ import org.w3c.dom.Node;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
import org.apache.batik.svggen.SVGGraphics2D;
import org.apache.batik.dom.svg.SVGDOMImplementation;
@@ -59,7 +59,7 @@ public class MathMLElement extends MathMLObj {
* @see org.apache.fop.fo.FONode#processNode
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist) throws SAXParseException {
+ Attributes attlist) throws FOPException {
super.processNode(elementName, locator, attlist);
createBasicDocument();
}
diff --git a/examples/plan/src/org/apache/fop/plan/PlanElement.java b/examples/plan/src/org/apache/fop/plan/PlanElement.java
index bdf6ec7fa..7bec2861d 100644
--- a/examples/plan/src/org/apache/fop/plan/PlanElement.java
+++ b/examples/plan/src/org/apache/fop/plan/PlanElement.java
@@ -20,13 +20,13 @@ package org.apache.fop.plan;
import java.awt.geom.Point2D;
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
import org.w3c.dom.Document;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
/**
* This class defines the plan element.
@@ -50,7 +50,7 @@ public class PlanElement extends PlanObj {
*/
public void processNode(String elementName, Locator locator,
Attributes attlist, PropertyList propertyList)
- throws SAXParseException
+ throws FOPException
{
super.processNode(elementName, locator, attlist, propertyList);
createBasicDocument();
diff --git a/src/java/org/apache/fop/apps/FOPException.java b/src/java/org/apache/fop/apps/FOPException.java
index 4cd855365..569a025f1 100644
--- a/src/java/org/apache/fop/apps/FOPException.java
+++ b/src/java/org/apache/fop/apps/FOPException.java
@@ -18,16 +18,16 @@
package org.apache.fop.apps;
+import org.xml.sax.Locator;
import org.xml.sax.SAXException;
/**
* Exception thrown when FOP has a problem.
*/
-public class FOPException extends Exception {
+public class FOPException extends SAXException {
private static final String EXCEPTION_SEPARATOR = "\n---------\n";
- private Throwable exception;
private String systemId;
private int line;
private int column;
@@ -48,13 +48,18 @@ public class FOPException extends Exception {
this.column = column;
}
+ public FOPException(String message, Locator locator) {
+ super(message);
+ setLocator(locator);
+ }
+
+
/**
*
* @param e Throwable object
*/
- public FOPException(Throwable e) {
- super(e.getMessage());
- setException(e);
+ public FOPException(Exception e) {
+ super(e);
}
/**
@@ -64,23 +69,14 @@ public class FOPException extends Exception {
*/
public FOPException(String message, Throwable e) {
super(message);
- setException(e);
- }
-
- /**
- * Sets exception
- * @param t Throwable object
- */
- protected void setException(Throwable t) {
- exception = t;
}
- /**
- * Accessor for exception
- * @return exception
- */
- public Throwable getException() {
- return exception;
+ public void setLocator(Locator locator) {
+ if (locator != null) {
+ this.systemId = locator.getSystemId();
+ this.line = locator.getLineNumber();
+ this.column = locator.getColumnNumber();
+ }
}
public void setLocation(String systemId, int line, int column) {
@@ -90,7 +86,15 @@ public class FOPException extends Exception {
}
public boolean isLocationSet() {
- return line>=0;
+ return line > 0;
+ }
+
+ public String getMessage() {
+ if (isLocationSet()) {
+ return systemId + ":" + line + "," + column + " " + super.getMessage();
+ } else {
+ return super.getMessage();
+ }
}
/**
@@ -98,7 +102,7 @@ public class FOPException extends Exception {
* @return the exception recast as another type if possible, otherwise null.
*/
protected Throwable getRootException() {
- Throwable result = exception;
+ Throwable result = getException();
if (result instanceof SAXException) {
result = ((SAXException)result).getException();
@@ -107,7 +111,7 @@ public class FOPException extends Exception {
result =
((java.lang.reflect.InvocationTargetException)result).getTargetException();
}
- if (result != exception) {
+ if (result != getException()) {
return result;
}
return null;
@@ -119,9 +123,9 @@ public class FOPException extends Exception {
public void printStackTrace() {
synchronized (System.err) {
super.printStackTrace();
- if (exception != null) {
+ if (getException() != null) {
System.err.println(EXCEPTION_SEPARATOR);
- exception.printStackTrace();
+ getException().printStackTrace();
}
if (getRootException() != null) {
System.err.println(EXCEPTION_SEPARATOR);
@@ -137,9 +141,9 @@ public class FOPException extends Exception {
public void printStackTrace(java.io.PrintStream stream) {
synchronized (stream) {
super.printStackTrace(stream);
- if (exception != null) {
+ if (getException() != null) {
stream.println(EXCEPTION_SEPARATOR);
- exception.printStackTrace(stream);
+ getException().printStackTrace(stream);
}
if (getRootException() != null) {
stream.println(EXCEPTION_SEPARATOR);
@@ -155,9 +159,9 @@ public class FOPException extends Exception {
public void printStackTrace(java.io.PrintWriter writer) {
synchronized (writer) {
super.printStackTrace(writer);
- if (exception != null) {
+ if (getException() != null) {
writer.println(EXCEPTION_SEPARATOR);
- exception.printStackTrace(writer);
+ getException().printStackTrace(writer);
}
if (getRootException() != null) {
writer.println(EXCEPTION_SEPARATOR);
diff --git a/src/java/org/apache/fop/datatypes/LengthBase.java b/src/java/org/apache/fop/datatypes/LengthBase.java
index e6b105d5c..45df34d8c 100644
--- a/src/java/org/apache/fop/datatypes/LengthBase.java
+++ b/src/java/org/apache/fop/datatypes/LengthBase.java
@@ -18,9 +18,10 @@
package org.apache.fop.datatypes;
-import org.apache.fop.fo.FObj;
import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Models a length which can be used as a factor in a percentage length
@@ -110,7 +111,7 @@ public class LengthBase implements PercentBase {
/**
* @return the base length (in millipoints ??) of this object
*/
- public int getBaseLength() {
+ public int getBaseLength() throws PropertyException {
switch (iBaseType) {
case FONTSIZE:
return propertyList.get(Constants.PR_FONT_SIZE).getLength().getValue();
diff --git a/src/java/org/apache/fop/datatypes/PercentBase.java b/src/java/org/apache/fop/datatypes/PercentBase.java
index 364084743..031a828ce 100644
--- a/src/java/org/apache/fop/datatypes/PercentBase.java
+++ b/src/java/org/apache/fop/datatypes/PercentBase.java
@@ -18,6 +18,8 @@
package org.apache.fop.datatypes;
+import org.apache.fop.fo.expr.PropertyException;
+
/**
* Interface for objects that can be used as base objects for percentage
* computations
@@ -37,5 +39,5 @@ public interface PercentBase {
* which a percentage will be applied to compute the length of the
* referencing item)
*/
- int getBaseLength();
+ int getBaseLength() throws PropertyException;
}
diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java
index 22a966f48..d128454be 100644
--- a/src/java/org/apache/fop/fo/FONode.java
+++ b/src/java/org/apache/fop/fo/FONode.java
@@ -21,19 +21,18 @@ package org.apache.fop.fo;
// Java
import java.util.List;
import java.util.ListIterator;
-import org.apache.commons.logging.Log;
-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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+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;
import org.apache.fop.fo.extensions.svg.SVGElementMapping;
+import org.apache.fop.util.CharUtilities;
/**
* base class for nodes in the XML tree
@@ -105,10 +104,10 @@ 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 SAXParseException for errors or inconsistencies in the attributes
+ * @throws FOPException for errors or inconsistencies in the attributes
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist, PropertyList parent) throws SAXParseException {
+ Attributes attlist, PropertyList parent) throws FOPException {
System.out.println("name = " + elementName);
}
@@ -120,7 +119,7 @@ public abstract class FONode {
* instance can be found.
* @return A new property list.
*/
- protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws SAXParseException {
+ protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws FOPException {
return null;
}
@@ -131,10 +130,10 @@ public abstract class FONode {
* called within FObj constructor
* @param namespaceURI namespace of incoming node
* @param localName (e.g. "table" for "fo:table")
- * @throws SAXParseException if incoming node not valid for parent
+ * @throws ValidationException if incoming node not valid for parent
*/
protected void validateChildNode(Locator loc, String namespaceURI, String localName)
- throws SAXParseException {}
+ throws ValidationException {}
/**
* Adds characters (does nothing here)
@@ -145,28 +144,28 @@ public abstract class FONode {
*/
protected void addCharacters(char data[], int start, int length,
PropertyList pList,
- Locator locator) throws SAXParseException {
+ Locator locator) throws FOPException {
// ignore
}
/**
*
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
// do nothing by default
}
/**
*
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
// do nothing by default
}
/**
* @param child child node to be added to the childNodes of this node
*/
- protected void addChildNode(FONode child) throws SAXParseException {
+ protected void addChildNode(FONode child) throws FOPException {
}
/**
@@ -232,8 +231,8 @@ public abstract class FONode {
* @param offendingNode incoming node that would cause a duplication.
*/
protected void attributeError(String problem)
- throws SAXParseException {
- throw new SAXParseException (errorText(locator) + getName() + ", " +
+ throws ValidationException {
+ throw new ValidationException(errorText(locator) + getName() + ", " +
problem, locator);
}
@@ -245,8 +244,8 @@ public abstract class FONode {
* @param lName local name (i.e., no prefix) of incoming node
*/
protected void tooManyNodesError(Locator loc, String nsURI, String lName)
- throws SAXParseException {
- throw new SAXParseException (errorText(loc) + getName() + ", only one "
+ throws ValidationException {
+ throw new ValidationException(errorText(loc) + getName() + ", only one "
+ getNodeString(nsURI, lName) + " may be declared.", loc);
}
@@ -258,8 +257,8 @@ public abstract class FONode {
* @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 "
+ throws ValidationException {
+ throw new ValidationException(errorText(loc) + getName() + ", only one "
+ offendingNode + " may be declared.", loc);
}
@@ -271,8 +270,8 @@ 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) throws SAXParseException {
- throw new SAXParseException (errorText(loc) + "For " + getName() + ", " + tooLateNode
+ String tooEarlyNode) throws ValidationException {
+ throw new ValidationException(errorText(loc) + "For " + getName() + ", " + tooLateNode
+ " must be declared before " + tooEarlyNode + ".", loc);
}
@@ -284,7 +283,7 @@ public abstract class FONode {
* @param lName local name (i.e., no prefix) of incoming node
*/
protected void invalidChildError(Locator loc, String nsURI, String lName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, lName, null);
}
@@ -298,8 +297,8 @@ public abstract class FONode {
*/
protected void invalidChildError(Locator loc, String nsURI, String lName,
String ruleViolated)
- throws SAXParseException {
- throw new SAXParseException (errorText(loc) + getNodeString(nsURI, lName) +
+ throws ValidationException {
+ throw new ValidationException(errorText(loc) + getNodeString(nsURI, lName) +
" is not a valid child element of " + getName()
+ ((ruleViolated != null) ? ": " + ruleViolated : "."), loc);
}
@@ -311,8 +310,8 @@ public abstract class FONode {
* or a similar description indicating child elements needed.
*/
protected void missingChildElementError(String contentModel)
- throws SAXParseException {
- throw new SAXParseException(errorText(locator) + getName() +
+ throws ValidationException {
+ throw new ValidationException(errorText(locator) + getName() +
" is missing child elements. \nRequired Content Model: "
+ contentModel, locator);
}
@@ -324,8 +323,8 @@ public abstract class FONode {
* or a similar description indicating child elements needed.
*/
protected void missingPropertyError(String propertyName)
- throws SAXParseException {
- throw new SAXParseException(errorText(locator) + getName() +
+ throws ValidationException {
+ throw new ValidationException(errorText(locator) + getName() +
" is missing required \"" + propertyName + "\" property.", locator);
}
diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/java/org/apache/fop/fo/FOPropertyMapping.java
index 1a04b6631..669a3793b 100644
--- a/src/java/org/apache/fop/fo/FOPropertyMapping.java
+++ b/src/java/org/apache/fop/fo/FOPropertyMapping.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.properties.BorderWidthPropertyMaker;
import org.apache.fop.fo.properties.BoxPropShorthandParser;
import org.apache.fop.fo.properties.CharacterProperty;
@@ -1535,7 +1536,7 @@ public class FOPropertyMapping implements Constants {
// text-align-last
m = new EnumProperty.Maker(PR_TEXT_ALIGN_LAST) {
- public Property compute(PropertyList propertyList) {
+ public Property compute(PropertyList propertyList) throws PropertyException {
Property corresponding = propertyList.get(PR_TEXT_ALIGN);
if (corresponding == null) {
return null;
diff --git a/src/java/org/apache/fop/fo/FOText.java b/src/java/org/apache/fop/fo/FOText.java
index 9c3b653ba..d5b36efc0 100644
--- a/src/java/org/apache/fop/fo/FOText.java
+++ b/src/java/org/apache/fop/fo/FOText.java
@@ -23,6 +23,7 @@ import java.util.List;
import java.util.NoSuchElementException;
// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.flow.Block;
import org.apache.fop.fo.pagination.Root;
@@ -132,7 +133,7 @@ public class FOText extends FONode {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonFont = pList.getFontProps();
commonHyphenation = pList.getHyphenationProps();
diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java
index 4b534535f..5c9909f64 100644
--- a/src/java/org/apache/fop/fo/FOTreeBuilder.java
+++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java
@@ -196,7 +196,7 @@ public class FOTreeBuilder extends DefaultHandler {
* @see org.xml.sax.ContentHandler#characters(char[], int, int)
*/
public void characters(char[] data, int start, int length)
- throws SAXParseException {
+ throws FOPException {
if (currentFObj != null) {
currentFObj.addCharacters(data, start, start + length, currentPropertyList, locator);
}
@@ -250,7 +250,8 @@ public class FOTreeBuilder extends DefaultHandler {
namespaceURI.equals(ExtensionElementMapping.URI)) {
try {
currentFObj.validateChildNode(locator, namespaceURI, localName);
- } catch (SAXParseException e) {
+ } catch (ValidationException e) {
+ // TODO: add relaxed validation.
throw e;
}
}
@@ -286,12 +287,8 @@ public class FOTreeBuilder extends DefaultHandler {
* @see org.xml.sax.ContentHandler#endElement(String, String, String)
*/
public void endElement(String uri, String localName, String rawName)
- throws SAXParseException {
- try {
- currentFObj.endOfNode();
- } catch (SAXParseException e) {
- throw e;
- }
+ throws FOPException {
+ currentFObj.endOfNode();
if (currentPropertyList.getFObj() == currentFObj) {
currentPropertyList = currentPropertyList.getParentPropertyList();
@@ -304,9 +301,9 @@ public class FOTreeBuilder extends DefaultHandler {
* @param namespaceURI URI for the namespace of the element
* @param localName name of the Element
* @return the ElementMapping.Maker that can create an FO object for this element
- * @throws SAXParseException if a Maker could not be found for a bound namespace.
+ * @throws FOPException if a Maker could not be found for a bound namespace.
*/
- private Maker findFOMaker(String namespaceURI, String localName) throws SAXParseException {
+ private Maker findFOMaker(String namespaceURI, String localName) throws FOPException {
Map table = (Map)fobjTable.get(namespaceURI);
Maker fobjMaker = null;
if (table != null) {
@@ -319,7 +316,7 @@ public class FOTreeBuilder extends DefaultHandler {
if (fobjMaker == null) {
if (namespaces.contains(namespaceURI.intern())) {
- throw new SAXParseException (FONode.errorText(locator) +
+ throw new FOPException(FONode.errorText(locator) +
"No element mapping definition found for "
+ FONode.getNodeString(namespaceURI, localName), locator);
} else {
diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java
index 9646fc772..87f989c02 100644
--- a/src/java/org/apache/fop/fo/FObj.java
+++ b/src/java/org/apache/fop/fo/FObj.java
@@ -25,12 +25,11 @@ 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.PropertyMaker;
-
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.
@@ -90,7 +89,7 @@ public class FObj extends FONode implements Constants {
* @see org.apache.fop.fo.FONode#processNode
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist, PropertyList pList) throws SAXParseException {
+ Attributes attlist, PropertyList pList) throws FOPException {
setLocator(locator);
pList.addAttributesToList(attlist);
pList.setWritingMode();
@@ -100,7 +99,7 @@ public class FObj extends FONode implements Constants {
/**
* Create a default property list for this element.
*/
- protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws SAXParseException {
+ protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws FOPException {
return foEventHandler.getPropertyListMaker().make(this, parent);
}
@@ -108,10 +107,10 @@ public class FObj extends FONode implements Constants {
* Bind property values from the property list to the FO node.
* Must be overriden in all FObj subclasses.
* @param pList the PropertyList where the properties can be found.
- * @throws SAXParseException
+ * @throws FOPException
*/
- public void bind(PropertyList pList) throws SAXParseException {
-// throw new SAXParseException("Unconverted element " + this, locator);
+ public void bind(PropertyList pList) throws FOPException {
+// throw new ValidationException("Unconverted element " + this, locator);
}
/**
@@ -120,13 +119,13 @@ public class FObj extends FONode implements Constants {
* This methods checks that the id isn't already used by another
* fo and sets the id attribute of this object.
*/
- protected void checkId(String id) throws SAXParseException {
+ protected void checkId(String id) throws ValidationException {
if (!id.equals("")) {
Set idrefs = getFOEventHandler().getIDReferences();
if (!idrefs.contains(id)) {
idrefs.add(id);
} else {
- throw new SAXParseException("Property id \"" + id +
+ throw new ValidationException("Property id \"" + id +
"\" previously used; id values must be unique" +
" in document.", locator);
}
@@ -144,7 +143,7 @@ public class FObj extends FONode implements Constants {
/**
* @see org.apache.fop.fo.FONode#addChildNode(FONode)
*/
- protected void addChildNode(FONode child) throws SAXParseException {
+ protected void addChildNode(FONode child) throws FOPException {
if (PropertySets.canHaveMarkers(getNameId()) &&
child.getNameId() == FO_MARKER) {
addMarker((Marker) child);
diff --git a/src/java/org/apache/fop/fo/FObjMixed.java b/src/java/org/apache/fop/fo/FObjMixed.java
index d7eac8dd3..9cf9ccd70 100644
--- a/src/java/org/apache/fop/fo/FObjMixed.java
+++ b/src/java/org/apache/fop/fo/FObjMixed.java
@@ -19,8 +19,10 @@
package org.apache.fop.fo;
import java.util.List;
+
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
+
+import org.apache.fop.apps.FOPException;
import org.apache.fop.layoutmgr.InlineStackingLayoutManager;
/**
@@ -43,7 +45,7 @@ public class FObjMixed extends FObj {
*/
protected void addCharacters(char data[], int start, int length,
PropertyList pList,
- Locator locator) throws SAXParseException {
+ Locator locator) throws FOPException {
FOText ft = new FOText(data, start, length, this);
ft.setLocator(locator);
ft.bind(pList);
diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/java/org/apache/fop/fo/PropertyList.java
index e31c2bdc2..c453b50ac 100644
--- a/src/java/org/apache/fop/fo/PropertyList.java
+++ b/src/java/org/apache/fop/fo/PropertyList.java
@@ -21,8 +21,11 @@ package org.apache.fop.fo;
// Java
import org.xml.sax.Attributes;
-// FOP
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.properties.CommonAbsolutePosition;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
@@ -35,9 +38,6 @@ import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.PropertyMaker;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/**
* Class containing the collection of properties for a given FObj.
*/
@@ -94,7 +94,7 @@ abstract public class PropertyList {
* @return The value if the property is explicitly set or set by
* a shorthand property, otherwise null.
*/
- public Property getExplicitOrShorthand(int propId) {
+ public Property getExplicitOrShorthand(int propId) throws PropertyException {
/* Handle request for one part of a compound property */
Property p = getExplicit(propId);
if (p == null) {
@@ -124,20 +124,14 @@ abstract public class PropertyList {
* @param propId The ID of the property whose value is desired.
* @return The inherited value, otherwise null.
*/
- public Property getInherited(int propId) {
+ public Property getInherited(int propId) throws PropertyException {
if (isInherited(propId)) {
return getFromParent(propId);
} else {
// return the "initial" value
- try {
- return makeProperty(propId);
- } catch (org.apache.fop.apps.FOPException e) {
- //log.error("Exception in getInherited(): property="
- // + propertyName + " : " + e);
- }
+ return makeProperty(propId);
}
- return null; // Exception in makeProperty!
}
/**
@@ -148,7 +142,7 @@ abstract public class PropertyList {
* @param propId The Constants ID of the property whose value is desired.
* @return the Property corresponding to that name
*/
- public Property get(int propId) {
+ public Property get(int propId) throws PropertyException {
return get(propId, true, true);
}
@@ -159,16 +153,11 @@ abstract public class PropertyList {
* the default value.
*/
public Property get(int propId, boolean bTryInherit,
- boolean bTryDefault) {
+ boolean bTryDefault) throws PropertyException {
PropertyMaker propertyMaker = findMaker(propId & Constants.PROPERTY_MASK);
- try {
- return propertyMaker.get(propId & Constants.COMPOUND_MASK, this,
+ return propertyMaker.get(propId & Constants.COMPOUND_MASK, this,
bTryInherit, bTryDefault);
- } catch (FOPException exc) {
- fobj.getLogger().error("Error during property processing", exc);
- }
- return null;
}
/**
@@ -178,7 +167,7 @@ abstract public class PropertyList {
* @return The computed value if the property is explicitly set on some
* ancestor of the current FO, else the initial value.
*/
- public Property getNearestSpecified(int propId) {
+ public Property getNearestSpecified(int propId) throws PropertyException {
Property p = null;
for (PropertyList plist = this; p == null && plist != null;
@@ -188,12 +177,7 @@ abstract public class PropertyList {
if (p == null) {
// If no explicit setting found, return initial (default) value.
- try {
- p = makeProperty(propId);
- } catch (FOPException e) {
- //log.error("Exception in getNearestSpecified(): property="
- // + propertyName + " : " + e);
- }
+ p = makeProperty(propId);
}
return p;
}
@@ -205,18 +189,12 @@ abstract public class PropertyList {
* @return The computed value on the parent or the initial value if this
* FO is the root or is in a different namespace from its parent.
*/
- public Property getFromParent(int propId) {
+ public Property getFromParent(int propId) throws PropertyException {
if (parentPropertyList != null) {
return parentPropertyList.get(propId);
} else {
- try {
- return makeProperty(propId);
- } catch (org.apache.fop.apps.FOPException e) {
- //log.error("Exception in getFromParent(): property="
- // + propertyName + " : " + e);
- }
+ return makeProperty(propId);
}
- return null; // Exception in makeProperty!
}
/**
@@ -224,7 +202,7 @@ abstract public class PropertyList {
* Use that from the nearest ancestor, including self, which generates
* reference areas, or from root FO if no ancestor found.
*/
- protected void setWritingMode() {
+ protected void setWritingMode() throws PropertyException {
FObj p = fobj.findNearestAncestorFObj();
// If this is a RA or the root, use the property value.
if (fobj.generatesReferenceAreas() || p == null) {
@@ -336,9 +314,9 @@ abstract public class PropertyList {
if (prop != null) {
putExplicit(propId, prop);
}
- } catch (FOPException e) {
- /**@todo log this exception */
- // log.error(e.getMessage());
+ } catch (PropertyException e) {
+ // TODO: Add strict validation.
+ log.error(e.getMessage());
}
}
@@ -347,7 +325,7 @@ abstract public class PropertyList {
int propId,
String basePropName,
PropertyMaker propertyMaker)
- throws FOPException {
+ throws PropertyException {
/* If the baseProperty has already been created, return it
* e.g. <fo:leader xxxx="120pt" xxxx.maximum="200pt"... />
@@ -416,7 +394,7 @@ abstract public class PropertyList {
* @param propId ID of property
* @return new Property object
*/
- private Property getShorthand(int propId) {
+ private Property getShorthand(int propId) throws PropertyException {
PropertyMaker propertyMaker = findMaker(propId);
if (propertyMaker != null) {
@@ -432,7 +410,7 @@ abstract public class PropertyList {
* @return new Property object
* @throws FOPException for errors in the input
*/
- private Property makeProperty(int propId) throws FOPException {
+ private Property makeProperty(int propId) throws PropertyException {
PropertyMaker propertyMaker = findMaker(propId);
if (propertyMaker != null) {
return propertyMaker.make(this);
@@ -477,7 +455,7 @@ abstract public class PropertyList {
* Constructs a BorderAndPadding object.
* @return a BorderAndPadding object
*/
- public CommonBorderPaddingBackground getBorderPaddingBackgroundProps() {
+ public CommonBorderPaddingBackground getBorderPaddingBackgroundProps() throws PropertyException {
return new CommonBorderPaddingBackground(this);
}
@@ -487,7 +465,7 @@ abstract public class PropertyList {
* Constructs a HyphenationProps objects.
* @return a HyphenationProps object
*/
- public CommonHyphenation getHyphenationProps() {
+ public CommonHyphenation getHyphenationProps() throws PropertyException {
return new CommonHyphenation(this);
}
@@ -495,7 +473,7 @@ abstract public class PropertyList {
* Constructs a MarginProps objects.
* @return a MarginProps object
*/
- public CommonMarginBlock getMarginBlockProps() {
+ public CommonMarginBlock getMarginBlockProps() throws PropertyException {
return new CommonMarginBlock(this);
}
@@ -503,7 +481,7 @@ abstract public class PropertyList {
* Constructs a MarginInlineProps objects.
* @return a MarginInlineProps object
*/
- public CommonMarginInline getMarginInlineProps() {
+ public CommonMarginInline getMarginInlineProps() throws PropertyException {
return new CommonMarginInline(this);
}
@@ -511,7 +489,7 @@ abstract public class PropertyList {
* Constructs a AccessibilityProps objects.
* @return a AccessibilityProps object
*/
- public CommonAccessibility getAccessibilityProps() {
+ public CommonAccessibility getAccessibilityProps() throws PropertyException {
return new CommonAccessibility(this);
}
@@ -519,7 +497,7 @@ abstract public class PropertyList {
* Constructs a AuralProps objects.
* @return a AuralProps object
*/
- public CommonAural getAuralProps() {
+ public CommonAural getAuralProps() throws PropertyException {
CommonAural props = new CommonAural(this);
return props;
}
@@ -528,7 +506,7 @@ abstract public class PropertyList {
* Constructs a RelativePositionProps objects.
* @return a RelativePositionProps object
*/
- public CommonRelativePosition getRelativePositionProps() {
+ public CommonRelativePosition getRelativePositionProps() throws PropertyException {
return new CommonRelativePosition(this);
}
@@ -536,7 +514,7 @@ abstract public class PropertyList {
* Constructs a AbsolutePositionProps objects.
* @return a AbsolutePositionProps object
*/
- public CommonAbsolutePosition getAbsolutePositionProps() {
+ public CommonAbsolutePosition getAbsolutePositionProps() throws PropertyException {
return new CommonAbsolutePosition(this);
}
@@ -545,7 +523,7 @@ abstract public class PropertyList {
* Constructs a CommonFont object.
* @return A CommonFont object
*/
- public CommonFont getFontProps() {
+ public CommonFont getFontProps() throws PropertyException {
return new CommonFont(this);
}
}
diff --git a/src/java/org/apache/fop/fo/StaticPropertyList.java b/src/java/org/apache/fop/fo/StaticPropertyList.java
index d1a3b67e4..77211b7a1 100755
--- a/src/java/org/apache/fop/fo/StaticPropertyList.java
+++ b/src/java/org/apache/fop/fo/StaticPropertyList.java
@@ -15,6 +15,7 @@
*/
package org.apache.fop.fo;
+import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.properties.Property;
/**
@@ -59,7 +60,9 @@ public class StaticPropertyList extends PropertyList {
* retrieved property values.
* @param propId The property ID
*/
- public Property get(int propId, boolean bTryInherit, boolean bTryDefault) {
+ public Property get(int propId, boolean bTryInherit, boolean bTryDefault)
+ throws PropertyException
+ {
Property p = values[propId];
if (p == null) {
p = values[propId] = super.get(propId, bTryInherit, bTryDefault);
diff --git a/src/java/org/apache/fop/fo/ValidationException.java b/src/java/org/apache/fop/fo/ValidationException.java
new file mode 100755
index 000000000..19e176beb
--- /dev/null
+++ b/src/java/org/apache/fop/fo/ValidationException.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.fo;
+
+import org.apache.fop.apps.FOPException;
+import org.xml.sax.Locator;
+
+/**
+ * Exception thrown during FO tree validation.
+ */
+public class ValidationException extends FOPException {
+ public ValidationException(String message) {
+ super(message);
+ }
+
+ public ValidationException(String message, Locator locator) {
+ super(message, locator);
+ }
+}
diff --git a/src/java/org/apache/fop/fo/XMLObj.java b/src/java/org/apache/fop/fo/XMLObj.java
index 3ff83ee68..244f17a54 100644
--- a/src/java/org/apache/fop/fo/XMLObj.java
+++ b/src/java/org/apache/fop/fo/XMLObj.java
@@ -22,12 +22,13 @@ package org.apache.fop.fo;
import java.awt.geom.Point2D;
import java.util.HashMap;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.fop.apps.FOPException;
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;
/**
* Abstract class modelling generic, non-XSL-FO XML objects. Such objects are
@@ -59,7 +60,7 @@ public abstract class XMLObj extends FONode {
* here, blocks XSL FO's from having non-FO parents.
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI) {
invalidChildError(loc, nsURI, localName);
}
@@ -69,7 +70,7 @@ public abstract class XMLObj extends FONode {
* @see org.apache.fop.fo.FONode#processNode
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist, PropertyList propertyList) throws SAXParseException {
+ Attributes attlist, PropertyList propertyList) throws FOPException {
setLocator(locator);
name = elementName;
attr = attlist;
diff --git a/src/java/org/apache/fop/fo/expr/NumericProperty.java b/src/java/org/apache/fop/fo/expr/NumericProperty.java
index 347fc8f84..6f337e0f5 100644
--- a/src/java/org/apache/fop/fo/expr/NumericProperty.java
+++ b/src/java/org/apache/fop/fo/expr/NumericProperty.java
@@ -104,7 +104,7 @@ public class NumericProperty extends Property implements Numeric, Length {
if (dim == 1) {
return this;
}
- System.err.print("Can't create length with dimension " + dim);
+ log.error("Can't create length with dimension " + dim);
return null;
}
diff --git a/src/java/org/apache/fop/fo/expr/PropertyException.java b/src/java/org/apache/fop/fo/expr/PropertyException.java
index 50a8c79e7..9ce3224b8 100644
--- a/src/java/org/apache/fop/fo/expr/PropertyException.java
+++ b/src/java/org/apache/fop/fo/expr/PropertyException.java
@@ -18,10 +18,13 @@
package org.apache.fop.fo.expr;
+import org.apache.fop.apps.FOPException;
+
/**
* Class for managing exceptions that are raised in Property processing.
*/
-public class PropertyException extends Exception {
+public class PropertyException extends FOPException {
+ private String propertyName;
/**
* Constructor
@@ -31,4 +34,24 @@ public class PropertyException extends Exception {
super(detail);
}
+ /**
+ */
+ public void setPropertyInfo(PropertyInfo propInfo) {
+ setLocator(propInfo.getFO().locator);
+ propertyName = propInfo.getPropertyMaker().getName();
+ }
+
+ /**
+ */
+ public void setPropertyName(String propertyName) {
+ this.propertyName = propertyName;
+ }
+
+ public String getMessage() {
+ if (propertyName != null) {
+ return super.getMessage() + "; property:'" + propertyName + "'";
+ } else {
+ return super.getMessage();
+ }
+ }
}
diff --git a/src/java/org/apache/fop/fo/expr/PropertyInfo.java b/src/java/org/apache/fop/fo/expr/PropertyInfo.java
index 100b523c6..fb59332de 100644
--- a/src/java/org/apache/fop/fo/expr/PropertyInfo.java
+++ b/src/java/org/apache/fop/fo/expr/PropertyInfo.java
@@ -65,7 +65,7 @@ public class PropertyInfo {
/**
* @return the current font-size value as base units (milli-points).
*/
- public int currentFontSize() {
+ public int currentFontSize() throws PropertyException {
return plist.get(Constants.PR_FONT_SIZE).getLength().getValue();
}
@@ -86,6 +86,14 @@ public class PropertyInfo {
}
/**
+ * accessor for PropertyMaker
+ * @return PropertyMaker object
+ */
+ public PropertyMaker getPropertyMaker() {
+ return maker;
+ }
+
+ /**
* push a function onto the function stack
* @param func function to push onto stack
*/
diff --git a/src/java/org/apache/fop/fo/expr/PropertyParser.java b/src/java/org/apache/fop/fo/expr/PropertyParser.java
index 51f87f10a..7d77d7f9b 100644
--- a/src/java/org/apache/fop/fo/expr/PropertyParser.java
+++ b/src/java/org/apache/fop/fo/expr/PropertyParser.java
@@ -85,7 +85,12 @@ public class PropertyParser extends PropertyTokenizer {
*/
public static Property parse(String expr, PropertyInfo propInfo)
throws PropertyException {
- return new PropertyParser(expr, propInfo).parseProperty();
+ try {
+ return new PropertyParser(expr, propInfo).parseProperty();
+ } catch (PropertyException exc) {
+ exc.setPropertyInfo(propInfo);
+ throw exc;
+ }
}
@@ -314,6 +319,7 @@ public class PropertyParser extends PropertyTokenizer {
return prop;
}
default:
+ // TODO: add the token or the expr to the error message.
throw new PropertyException("syntax error");
}
next();
diff --git a/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java b/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java
index 02d7b4f9c..c20017f85 100755
--- a/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java
+++ b/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java
@@ -154,7 +154,7 @@ public class RelativeNumericProperty extends Property implements Numeric, Length
if (dimension == 1) {
return this;
}
- System.err.print("Can't create length with dimension " + dimension);
+ log.error("Can't create length with dimension " + dimension);
return null;
}
@@ -169,7 +169,7 @@ public class RelativeNumericProperty extends Property implements Numeric, Length
try {
return (int) getNumericValue();
} catch (PropertyException exc) {
- exc.printStackTrace();
+ log.error(exc);
}
return 0;
}
diff --git a/src/java/org/apache/fop/fo/extensions/Bookmarks.java b/src/java/org/apache/fop/fo/extensions/Bookmarks.java
index a9273fccc..7573da0c1 100644
--- a/src/java/org/apache/fop/fo/extensions/Bookmarks.java
+++ b/src/java/org/apache/fop/fo/extensions/Bookmarks.java
@@ -21,10 +21,7 @@ package org.apache.fop.fo.extensions;
// Java
import java.util.ArrayList;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.pagination.Root;
@@ -59,7 +56,7 @@ public class Bookmarks extends ExtensionObj {
* the bookmark data from the child elements and add
* the extension to the area tree.
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
((Root) parent).setBookmarks(this);
}
diff --git a/src/java/org/apache/fop/fo/extensions/ExtensionObj.java b/src/java/org/apache/fop/fo/extensions/ExtensionObj.java
index 646b24b68..37aad8bcb 100644
--- a/src/java/org/apache/fop/fo/extensions/ExtensionObj.java
+++ b/src/java/org/apache/fop/fo/extensions/ExtensionObj.java
@@ -18,13 +18,13 @@
package org.apache.fop.fo.extensions;
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
/**
@@ -46,7 +46,7 @@ public abstract class ExtensionObj extends FObj {
*/
public void processNode(String elementName, Locator locator,
Attributes attlist, PropertyList pList)
- throws SAXParseException
+ throws FOPException
{
// Empty
}
@@ -55,7 +55,7 @@ public abstract class ExtensionObj extends FObj {
* Create a default property list for this element.
*/
protected PropertyList createPropertyList(PropertyList parent,
- FOEventHandler foEventHandler) throws SAXParseException {
+ FOEventHandler foEventHandler) throws FOPException {
return null;
}
}
diff --git a/src/java/org/apache/fop/fo/extensions/Outline.java b/src/java/org/apache/fop/fo/extensions/Outline.java
index 6d3ed01ae..a7df6327e 100644
--- a/src/java/org/apache/fop/fo/extensions/Outline.java
+++ b/src/java/org/apache/fop/fo/extensions/Outline.java
@@ -18,15 +18,15 @@
package org.apache.fop.fo.extensions;
-import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.PropertyList;
-
import java.util.ArrayList;
import org.xml.sax.Attributes;
-import org.xml.sax.SAXParseException;
import org.xml.sax.Locator;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.PropertyList;
+
/**
* The outline object for the pdf bookmark extension.
@@ -55,7 +55,7 @@ public class Outline extends ExtensionObj {
* @see org.apache.fop.fo.FObj#processNode
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist, PropertyList propertyList) throws SAXParseException
+ Attributes attlist, PropertyList propertyList) throws FOPException
{
internalDestination =
attlist.getValue("internal-destination");
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 cd523da58..7dfd3dd22 100644
--- a/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
+++ b/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
@@ -19,6 +19,7 @@
package org.apache.fop.fo.extensions.svg;
// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
@@ -30,7 +31,6 @@ 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, PropertyList propertyList) throws SAXParseException {
+ Attributes attlist, PropertyList propertyList) throws FOPException {
super.processNode(elementName, locator, attlist, propertyList);
init();
}
diff --git a/src/java/org/apache/fop/fo/flow/BasicLink.java b/src/java/org/apache/fop/fo/flow/BasicLink.java
index ccb94584a..1e61abc9e 100644
--- a/src/java/org/apache/fop/fo/flow/BasicLink.java
+++ b/src/java/org/apache/fop/fo/flow/BasicLink.java
@@ -21,13 +21,12 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.layoutmgr.BasicLinkLayoutManager;
/**
@@ -63,7 +62,7 @@ public class BasicLink extends Inline {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
// destinationPlacementOffset = pList.get(PR_DESTINATION_PLACEMENT_OFFSET);
// dominantBaseline = pList.get(PR_DOMINANT_BASELINE);
@@ -88,7 +87,7 @@ public class BasicLink extends Inline {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
super.startOfNode();
getFOEventHandler().startLink(this);
}
@@ -96,7 +95,7 @@ public class BasicLink extends Inline {
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
super.endOfNode();
getFOEventHandler().endLink();
}
@@ -106,7 +105,7 @@ public class BasicLink extends Inline {
* XSL Content Model: marker* (#PCDATA|%inline;|%block;)*
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (blockOrInlineItemFound) {
nodesOutOfOrderError(loc, "fo:marker", "(#PCDATA|%inline;|%block;)");
diff --git a/src/java/org/apache/fop/fo/flow/BidiOverride.java b/src/java/org/apache/fop/fo/flow/BidiOverride.java
index 3f5740a35..5c156d7d4 100644
--- a/src/java/org/apache/fop/fo/flow/BidiOverride.java
+++ b/src/java/org/apache/fop/fo/flow/BidiOverride.java
@@ -22,15 +22,14 @@ package org.apache.fop.fo.flow;
import java.util.ArrayList;
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.ColorTypeProperty;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonFont;
@@ -93,7 +92,7 @@ public class BidiOverride extends FObjMixed {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAural = pList.getAuralProps();
commonFont = pList.getFontProps();
commonRelativePosition = pList.getRelativePositionProps();
@@ -115,7 +114,7 @@ public class BidiOverride extends FObjMixed {
* fo:inline-container."
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (blockOrInlineItemFound) {
nodesOutOfOrderError(loc, "fo:marker",
diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java
index b7c54bb79..cbdbc435f 100644
--- a/src/java/org/apache/fop/fo/flow/Block.java
+++ b/src/java/org/apache/fop/fo/flow/Block.java
@@ -21,21 +21,21 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
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.datatypes.Numeric;
import org.apache.fop.fo.CharIterator;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOText;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.PropertySets;
import org.apache.fop.fo.RecursiveCharIterator;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -46,7 +46,6 @@ import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.SpaceProperty;
import org.apache.fop.layoutmgr.BlockLayoutManager;
-import org.apache.fop.fo.Constants;
import org.apache.fop.util.CharUtilities;
/*
@@ -129,7 +128,7 @@ public class Block extends FObjMixed {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -170,7 +169,7 @@ public class Block extends FObjMixed {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startBlock(this);
}
@@ -178,7 +177,7 @@ public class Block extends FObjMixed {
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
handleWhiteSpace();
getFOEventHandler().endBlock(this);
}
@@ -283,7 +282,7 @@ public class Block extends FObjMixed {
* fo:inline-container."
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (blockOrInlineItemFound || initialPropertySetFound) {
nodesOutOfOrderError(loc, "fo:marker",
@@ -308,7 +307,7 @@ public class Block extends FObjMixed {
/**
* @see org.apache.fop.fo.FONode#addChildNode(FONode)
*/
- public void addChildNode(FONode child) throws SAXParseException {
+ public void addChildNode(FONode child) throws FOPException {
// Handle whitespace based on values of properties
// Handle a sequence of inline-producing child nodes in
// one pass
diff --git a/src/java/org/apache/fop/fo/flow/BlockContainer.java b/src/java/org/apache/fop/fo/flow/BlockContainer.java
index 3c0d1e1c2..9317a8ae0 100644
--- a/src/java/org/apache/fop/fo/flow/BlockContainer.java
+++ b/src/java/org/apache/fop/fo/flow/BlockContainer.java
@@ -21,7 +21,7 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.FONode;
@@ -34,8 +34,6 @@ import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.LengthRangeProperty;
import org.apache.fop.layoutmgr.BlockContainerLayoutManager;
-import org.xml.sax.SAXParseException;
-
/**
* Class modelling the fo:block-container object.
* @todo implement validateChildNode()
@@ -75,7 +73,7 @@ public class BlockContainer extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAbsolutePosition = pList.getAbsolutePositionProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
commonMarginBlock = pList.getMarginBlockProps();
@@ -102,7 +100,7 @@ public class BlockContainer extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startBlockContainer(this);
}
@@ -110,7 +108,7 @@ public class BlockContainer extends FObj {
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endBlockContainer(this);
}
diff --git a/src/java/org/apache/fop/fo/flow/Character.java b/src/java/org/apache/fop/fo/flow/Character.java
index 959a60036..fee7c3e36 100644
--- a/src/java/org/apache/fop/fo/flow/Character.java
+++ b/src/java/org/apache/fop/fo/flow/Character.java
@@ -21,17 +21,17 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
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.CharIterator;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.OneCharIterator;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonFont;
@@ -40,7 +40,6 @@ import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.Property;
-import org.apache.fop.fo.OneCharIterator;
import org.apache.fop.layoutmgr.CharacterLayoutManager;
/**
@@ -104,7 +103,7 @@ public class Character extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
commonFont = pList.getFontProps();
@@ -140,7 +139,7 @@ public class Character extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().character(this);
}
@@ -150,7 +149,7 @@ public class Character extends FObj {
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
index 20ee6d03f..f471c04c4 100644
--- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
+++ b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
@@ -21,15 +21,14 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -88,7 +87,7 @@ public class ExternalGraphic extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -122,7 +121,7 @@ public class ExternalGraphic extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().image(this);
}
@@ -132,7 +131,7 @@ public class ExternalGraphic extends FObj {
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
diff --git a/src/java/org/apache/fop/fo/flow/Float.java b/src/java/org/apache/fop/fo/flow/Float.java
index b846260c4..f6dde0468 100644
--- a/src/java/org/apache/fop/fo/flow/Float.java
+++ b/src/java/org/apache/fop/fo/flow/Float.java
@@ -20,12 +20,12 @@ package org.apache.fop.fo.flow;
// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
/**
* fo:float element.
@@ -53,7 +53,7 @@ public class Float extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
// float = pList.get(PR_FLOAT);
// clear = pList.get(PR_CLEAR);
}
@@ -63,7 +63,7 @@ public class Float extends FObj {
* XSL Content Model: (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!isBlockItem(nsURI, localName)) {
invalidChildError(loc, nsURI, localName);
}
@@ -74,7 +74,7 @@ public class Float extends FObj {
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("(%block;)+");
}
diff --git a/src/java/org/apache/fop/fo/flow/Footnote.java b/src/java/org/apache/fop/fo/flow/Footnote.java
index 7c7bc1a91..9c40c4fbb 100644
--- a/src/java/org/apache/fop/fo/flow/Footnote.java
+++ b/src/java/org/apache/fop/fo/flow/Footnote.java
@@ -21,14 +21,13 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
/**
@@ -52,14 +51,14 @@ public class Footnote extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
getFOEventHandler().startFootnote(this);
}
@@ -68,7 +67,7 @@ public class Footnote extends FObj {
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
super.endOfNode();
if (inlineFO == null || footnoteBody == null) {
missingChildElementError("(inline,footnote-body)");
@@ -86,7 +85,7 @@ public class Footnote extends FObj {
* generates an absolutely positioned area.
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("inline")) {
if (inlineFO != null) {
tooManyNodesError(loc, "fo:inline");
diff --git a/src/java/org/apache/fop/fo/flow/FootnoteBody.java b/src/java/org/apache/fop/fo/flow/FootnoteBody.java
index 671e44d00..703cc9c02 100644
--- a/src/java/org/apache/fop/fo/flow/FootnoteBody.java
+++ b/src/java/org/apache/fop/fo/flow/FootnoteBody.java
@@ -20,12 +20,12 @@ package org.apache.fop.fo.flow;
// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
/**
@@ -44,37 +44,37 @@ public class FootnoteBody extends FObj {
}
/**
- * Make sure content model satisfied, if so then tell the
- * FOEventHandler that we are at the end of the flow.
- * @see org.apache.fop.fo.FONode#endOfNode
- */
- protected void endOfNode() throws SAXParseException {
- if (childNodes == null) {
- missingChildElementError("(%block;)+");
- }
- getFOEventHandler().endFootnoteBody(this);
- }
-
- /**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
getFOEventHandler().startFootnoteBody(this);
}
/**
+ * Make sure content model satisfied, if so then tell the
+ * FOEventHandler that we are at the end of the flow.
+ * @see org.apache.fop.fo.FONode#endOfNode
+ */
+ protected void endOfNode() throws FOPException {
+ if (childNodes == null) {
+ missingChildElementError("(%block;)+");
+ }
+ getFOEventHandler().endFootnoteBody(this);
+ }
+
+ /**
* @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
* XSL Content Model: (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!isBlockItem(nsURI, localName)) {
invalidChildError(loc, nsURI, localName);
}
diff --git a/src/java/org/apache/fop/fo/flow/InitialPropertySet.java b/src/java/org/apache/fop/fo/flow/InitialPropertySet.java
index 27c83b368..dd1f2a38f 100644
--- a/src/java/org/apache/fop/fo/flow/InitialPropertySet.java
+++ b/src/java/org/apache/fop/fo/flow/InitialPropertySet.java
@@ -20,11 +20,13 @@ package org.apache.fop.fo.flow;
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.ColorTypeProperty;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
@@ -32,8 +34,6 @@ import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonFont;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.SpaceProperty;
-import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.FObj;
/**
* Class modelling the fo:initial-property-set object.
@@ -66,7 +66,7 @@ public class InitialPropertySet extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -86,7 +86,7 @@ public class InitialPropertySet extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
@@ -95,7 +95,7 @@ public class InitialPropertySet extends FObj {
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
diff --git a/src/java/org/apache/fop/fo/flow/Inline.java b/src/java/org/apache/fop/fo/flow/Inline.java
index acbdaccd9..75b96b235 100644
--- a/src/java/org/apache/fop/fo/flow/Inline.java
+++ b/src/java/org/apache/fop/fo/flow/Inline.java
@@ -20,11 +20,9 @@ package org.apache.fop.fo.flow;
import java.util.List;
-// XML
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.CharIterator;
@@ -32,6 +30,7 @@ import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.InlineCharIterator;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -86,7 +85,7 @@ public class Inline extends FObjMixed {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -115,7 +114,7 @@ public class Inline extends FObjMixed {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
/* Check to see if this node can have block-level children.
* See validateChildNode() below.
*/
@@ -141,7 +140,7 @@ public class Inline extends FObjMixed {
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endInline(this);
}
@@ -153,7 +152,7 @@ public class Inline extends FObjMixed {
* nearer ancestor that is an fo:inline-container." (paraphrased)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (blockOrInlineItemFound) {
nodesOutOfOrderError(loc, "fo:marker",
diff --git a/src/java/org/apache/fop/fo/flow/InlineContainer.java b/src/java/org/apache/fop/fo/flow/InlineContainer.java
index 7fae66003..fb1f8dd8f 100644
--- a/src/java/org/apache/fop/fo/flow/InlineContainer.java
+++ b/src/java/org/apache/fop/fo/flow/InlineContainer.java
@@ -19,17 +19,12 @@
package org.apache.fop.fo.flow;
// Java
-import java.util.List;
import java.util.ArrayList;
+import java.util.List;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
-import org.apache.fop.layoutmgr.LayoutManager;
-import org.apache.fop.layoutmgr.ICLayoutManager;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
@@ -38,6 +33,8 @@ import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.LengthRangeProperty;
+import org.apache.fop.layoutmgr.ICLayoutManager;
+import org.apache.fop.layoutmgr.LayoutManager;
/**
* Class modelling the fo:inline-container object.
@@ -78,7 +75,7 @@ public class InlineContainer extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
commonMarginInline = pList.getMarginInlineProps();
commonRelativePosition = pList.getRelativePositionProps();
@@ -105,7 +102,7 @@ public class InlineContainer extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
diff --git a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java
index f33ea4087..46950149f 100644
--- a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java
+++ b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java
@@ -21,15 +21,14 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
-import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -87,7 +86,7 @@ public class InstreamForeignObject extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -120,7 +119,7 @@ public class InstreamForeignObject extends FObj {
/**
* @see org.apache.fop.fo.FONode#start
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
@@ -129,7 +128,7 @@ public class InstreamForeignObject extends FObj {
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes.size() != 1) {
missingChildElementError("one (1) non-XSL namespace child");
}
@@ -140,7 +139,7 @@ public class InstreamForeignObject extends FObj {
* XSL Content Model: one (1) non-XSL namespace child
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI) {
invalidChildError(loc, nsURI, localName);
} else if (childNodes != null) {
diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java
index 0480f426e..9cbdda05c 100644
--- a/src/java/org/apache/fop/fo/flow/Leader.java
+++ b/src/java/org/apache/fop/fo/flow/Leader.java
@@ -21,10 +21,7 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
-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;
@@ -88,7 +85,7 @@ public class Leader extends FObjMixed {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -136,7 +133,7 @@ public class Leader extends FObjMixed {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
diff --git a/src/java/org/apache/fop/fo/flow/ListBlock.java b/src/java/org/apache/fop/fo/flow/ListBlock.java
index 75c86be63..fbec18edd 100644
--- a/src/java/org/apache/fop/fo/flow/ListBlock.java
+++ b/src/java/org/apache/fop/fo/flow/ListBlock.java
@@ -21,15 +21,14 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -72,7 +71,7 @@ public class ListBlock extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -92,7 +91,7 @@ public class ListBlock extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startList(this);
}
@@ -102,7 +101,7 @@ public class ListBlock extends FObj {
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (!hasListItem) {
missingChildElementError("marker* (list-item)+");
}
@@ -114,7 +113,7 @@ public class ListBlock extends FObj {
* XSL Content Model: marker* (list-item)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (hasListItem) {
nodesOutOfOrderError(loc, "fo:marker", "fo:list-item");
diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/java/org/apache/fop/fo/flow/ListItem.java
index 6297a619f..437df4803 100644
--- a/src/java/org/apache/fop/fo/flow/ListItem.java
+++ b/src/java/org/apache/fop/fo/flow/ListItem.java
@@ -21,14 +21,13 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -70,7 +69,7 @@ public class ListItem extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -89,7 +88,7 @@ public class ListItem extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startListItem(this);
}
@@ -99,7 +98,7 @@ public class ListItem extends FObj {
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (label == null || body == null) {
missingChildElementError("marker* (list-item-label,list-item-body)");
}
@@ -111,7 +110,7 @@ public class ListItem extends FObj {
* XSL Content Model: marker* (list-item-label,list-item-body)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (label != null) {
nodesOutOfOrderError(loc, "fo:marker", "fo:list-item-label");
diff --git a/src/java/org/apache/fop/fo/flow/ListItemBody.java b/src/java/org/apache/fop/fo/flow/ListItemBody.java
index 1f79c7584..883f52a21 100644
--- a/src/java/org/apache/fop/fo/flow/ListItemBody.java
+++ b/src/java/org/apache/fop/fo/flow/ListItemBody.java
@@ -18,10 +18,7 @@
package org.apache.fop.fo.flow;
-// XML
-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.PropertyList;
@@ -49,7 +46,7 @@ public class ListItemBody extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
id = pList.get(PR_ID).getString();
keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep();
@@ -58,7 +55,7 @@ public class ListItemBody extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startListBody();
}
@@ -66,7 +63,7 @@ public class ListItemBody extends FObj {
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endListBody();
}
diff --git a/src/java/org/apache/fop/fo/flow/ListItemLabel.java b/src/java/org/apache/fop/fo/flow/ListItemLabel.java
index 3f02ca7f2..e6413e2a3 100644
--- a/src/java/org/apache/fop/fo/flow/ListItemLabel.java
+++ b/src/java/org/apache/fop/fo/flow/ListItemLabel.java
@@ -18,10 +18,7 @@
package org.apache.fop.fo.flow;
-// XML
-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.PropertyList;
@@ -49,7 +46,7 @@ public class ListItemLabel extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
id = pList.get(PR_ID).getString();
keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep();
@@ -58,7 +55,7 @@ public class ListItemLabel extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startListLabel();
}
@@ -66,7 +63,7 @@ public class ListItemLabel extends FObj {
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endListLabel();
}
diff --git a/src/java/org/apache/fop/fo/flow/Marker.java b/src/java/org/apache/fop/fo/flow/Marker.java
index 9de83093f..cb008d889 100644
--- a/src/java/org/apache/fop/fo/flow/Marker.java
+++ b/src/java/org/apache/fop/fo/flow/Marker.java
@@ -21,18 +21,17 @@ package org.apache.fop.fo.flow;
import java.util.HashMap;
import java.util.Iterator;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FObjMixed;
-import org.apache.fop.fo.FOEventHandler;
-import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.PropertyListMaker;
+import org.apache.fop.fo.ValidationException;
+import org.apache.fop.fo.properties.Property;
/**
* Marker formatting object.
@@ -57,7 +56,7 @@ public class Marker extends FObjMixed {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
markerClassName = pList.get(PR_MARKER_CLASS_NAME).getString();
}
@@ -66,7 +65,7 @@ public class Marker extends FObjMixed {
* parentPropertyList which comes from the fo:retrieve-marker element.
* @param parentPropertyList The property list from fo:retrieve-marker.
*/
- public void rebind(PropertyList parentPropertyList) throws SAXParseException {
+ public void rebind(PropertyList parentPropertyList) throws FOPException {
// Set a new parent property list and bind all the children again.
propertyList.setParentPropertyList(parentPropertyList);
for (Iterator i = children.keySet().iterator(); i.hasNext(); ) {
@@ -76,7 +75,7 @@ public class Marker extends FObjMixed {
}
}
- protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws SAXParseException {
+ protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws FOPException {
propertyList = new MarkerPropertyList(this, parent);
return propertyList;
}
@@ -94,7 +93,7 @@ public class Marker extends FObjMixed {
});
}
- protected void addChildNode(FONode child) throws SAXParseException {
+ protected void addChildNode(FONode child) throws FOPException {
if (!children.containsKey(child)) {
children.put(child, propertyList);
}
@@ -116,7 +115,7 @@ public class Marker extends FObjMixed {
* @todo implement "additional" constraint, possibly within fo:retrieve-marker
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!isBlockOrInlineItem(nsURI, localName)) {
invalidChildError(loc, nsURI, localName);
}
diff --git a/src/java/org/apache/fop/fo/flow/MultiCase.java b/src/java/org/apache/fop/fo/flow/MultiCase.java
index 5ad05fd0a..c1b09d780 100644
--- a/src/java/org/apache/fop/fo/flow/MultiCase.java
+++ b/src/java/org/apache/fop/fo/flow/MultiCase.java
@@ -18,10 +18,7 @@
package org.apache.fop.fo.flow;
-// XML
-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.PropertyList;
@@ -57,7 +54,7 @@ public class MultiCase extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
id = pList.get(PR_ID).getString();
// startingState = pList.get(PR_STARTING_STATE);
@@ -68,7 +65,7 @@ public class MultiCase extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
diff --git a/src/java/org/apache/fop/fo/flow/MultiProperties.java b/src/java/org/apache/fop/fo/flow/MultiProperties.java
index 9400df421..dff9da798 100644
--- a/src/java/org/apache/fop/fo/flow/MultiProperties.java
+++ b/src/java/org/apache/fop/fo/flow/MultiProperties.java
@@ -20,12 +20,12 @@ package org.apache.fop.fo.flow;
// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
/**
@@ -58,7 +58,7 @@ public class MultiProperties extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
id = pList.get(PR_ID).getString();
}
@@ -66,7 +66,7 @@ public class MultiProperties extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
@@ -75,7 +75,7 @@ public class MultiProperties extends FObj {
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (!hasMultiPropertySet || !hasWrapper) {
missingChildElementError("(multi-property-set+, wrapper)");
}
@@ -86,7 +86,7 @@ public class MultiProperties extends FObj {
* XSL Content Model: (multi-property-set+, wrapper)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("multi-property-set")) {
if (hasWrapper) {
nodesOutOfOrderError(loc, "fo:multi-property-set", "fo:wrapper");
diff --git a/src/java/org/apache/fop/fo/flow/MultiPropertySet.java b/src/java/org/apache/fop/fo/flow/MultiPropertySet.java
index f476d187d..f332f850a 100644
--- a/src/java/org/apache/fop/fo/flow/MultiPropertySet.java
+++ b/src/java/org/apache/fop/fo/flow/MultiPropertySet.java
@@ -20,12 +20,12 @@ package org.apache.fop.fo.flow;
// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
/**
* Class modelling the fo:multi-property-set object.
@@ -53,7 +53,7 @@ public class MultiPropertySet extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
id = pList.get(PR_ID).getString();
// activeState = pList.get(PR_ACTIVE_STATE);
}
@@ -61,7 +61,7 @@ public class MultiPropertySet extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
@@ -70,7 +70,7 @@ public class MultiPropertySet extends FObj {
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
diff --git a/src/java/org/apache/fop/fo/flow/MultiSwitch.java b/src/java/org/apache/fop/fo/flow/MultiSwitch.java
index f0a72a0ad..1384be281 100644
--- a/src/java/org/apache/fop/fo/flow/MultiSwitch.java
+++ b/src/java/org/apache/fop/fo/flow/MultiSwitch.java
@@ -20,12 +20,12 @@ package org.apache.fop.fo.flow;
// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
/**
@@ -56,7 +56,7 @@ public class MultiSwitch extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
// autoRestore = pList.get(PR_AUTO_RESTORE);
id = pList.get(PR_ID).getString();
@@ -65,7 +65,7 @@ public class MultiSwitch extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
@@ -73,7 +73,7 @@ public class MultiSwitch extends FObj {
* Make sure content model satisfied.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("(multi-case+)");
}
@@ -84,7 +84,7 @@ public class MultiSwitch extends FObj {
* XSL Content Model: (multi-case+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!(nsURI == FO_URI && localName.equals("multi-case"))) {
invalidChildError(loc, nsURI, localName);
}
diff --git a/src/java/org/apache/fop/fo/flow/MultiToggle.java b/src/java/org/apache/fop/fo/flow/MultiToggle.java
index d4bc23628..7c0111cde 100644
--- a/src/java/org/apache/fop/fo/flow/MultiToggle.java
+++ b/src/java/org/apache/fop/fo/flow/MultiToggle.java
@@ -19,6 +19,7 @@
package org.apache.fop.fo.flow;
// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
@@ -51,7 +52,7 @@ public class MultiToggle extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
// prSwitchTo = pList.get(PR_SWITCH_TO);
diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java
index 9e81694b9..6d245fa2a 100644
--- a/src/java/org/apache/fop/fo/flow/PageNumber.java
+++ b/src/java/org/apache/fop/fo/flow/PageNumber.java
@@ -21,15 +21,14 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -81,7 +80,7 @@ public class PageNumber extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -111,7 +110,7 @@ public class PageNumber extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startPageNumber(this);
}
@@ -119,7 +118,7 @@ public class PageNumber extends FObj {
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endPageNumber(this);
}
@@ -128,7 +127,7 @@ public class PageNumber extends FObj {
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java
index 9d62c96db..1e12f5106 100644
--- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java
+++ b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java
@@ -21,15 +21,14 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -85,7 +84,7 @@ public class PageNumberCitation extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -116,7 +115,7 @@ public class PageNumberCitation extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
if (refId.equals("")) {
missingPropertyError("ref-id");
@@ -128,7 +127,7 @@ public class PageNumberCitation extends FObj {
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
diff --git a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
index 7d8a4fd02..400ee3af7 100644
--- a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
+++ b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
@@ -21,16 +21,15 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObjMixed;
-import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.StaticPropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.layoutmgr.RetrieveMarkerLayoutManager;
@@ -60,7 +59,7 @@ public class RetrieveMarker extends FObjMixed {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
retrieveClassName = pList.get(PR_RETRIEVE_CLASS_NAME).getString();
retrievePosition = pList.get(PR_RETRIEVE_POSITION).getEnum();
retrieveBoundary = pList.get(PR_RETRIEVE_BOUNDARY).getEnum();
@@ -71,12 +70,12 @@ public class RetrieveMarker extends FObjMixed {
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
protected PropertyList createPropertyList(PropertyList parent,
- FOEventHandler foEventHandler) throws SAXParseException {
+ FOEventHandler foEventHandler) throws FOPException {
// TODO: A special RetrieveMarkerPropertyList would be more memory
// efficient. Storing a StaticPropertyList like this will keep all
// the parent PropertyLists alive.
diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java
index 9ebd94d5f..7e374dbd5 100644
--- a/src/java/org/apache/fop/fo/flow/Table.java
+++ b/src/java/org/apache/fop/fo/flow/Table.java
@@ -19,14 +19,11 @@
package org.apache.fop.fo.flow;
// Java
+import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
-import java.util.ArrayList;
-
-// XML
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
@@ -39,9 +36,9 @@ import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.LengthPairProperty;
import org.apache.fop.fo.properties.LengthRangeProperty;
-import org.apache.fop.layoutmgr.table.TableLayoutManager;
import org.apache.fop.layoutmgr.table.Body;
import org.apache.fop.layoutmgr.table.Column;
+import org.apache.fop.layoutmgr.table.TableLayoutManager;
/**
* Class modelling the fo:table object.
@@ -93,7 +90,7 @@ public class Table extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -125,7 +122,7 @@ public class Table extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startTable(this);
}
@@ -133,14 +130,14 @@ public class Table extends FObj {
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endTable(this);
}
/**
* @see org.apache.fop.fo.FONode#addChildNode(FONode)
*/
- protected void addChildNode(FONode child) throws SAXParseException {
+ protected void addChildNode(FONode child) throws FOPException {
if (child.getName().equals("fo:table-column")) {
if (columns == null) {
columns = new ArrayList();
diff --git a/src/java/org/apache/fop/fo/flow/TableAndCaption.java b/src/java/org/apache/fop/fo/flow/TableAndCaption.java
index beadf6279..efb91cfed 100644
--- a/src/java/org/apache/fop/fo/flow/TableAndCaption.java
+++ b/src/java/org/apache/fop/fo/flow/TableAndCaption.java
@@ -20,12 +20,12 @@ package org.apache.fop.fo.flow;
// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -76,7 +76,7 @@ public class TableAndCaption extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -96,7 +96,7 @@ public class TableAndCaption extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
@@ -105,7 +105,7 @@ public class TableAndCaption extends FObj {
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (!tableFound) {
missingChildElementError("marker* table-caption? table");
}
@@ -116,7 +116,7 @@ public class TableAndCaption extends FObj {
* XSL Content Model: marker* table-caption? table
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (tableCaptionFound) {
diff --git a/src/java/org/apache/fop/fo/flow/TableBody.java b/src/java/org/apache/fop/fo/flow/TableBody.java
index e3ed61007..bb864501c 100644
--- a/src/java/org/apache/fop/fo/flow/TableBody.java
+++ b/src/java/org/apache/fop/fo/flow/TableBody.java
@@ -21,10 +21,7 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
-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.PropertyList;
@@ -61,7 +58,7 @@ public class TableBody extends FObj {
/**
* @see FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -76,14 +73,14 @@ public class TableBody extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
getFOEventHandler().startBody(this);
}
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endBody(this);
}
diff --git a/src/java/org/apache/fop/fo/flow/TableCaption.java b/src/java/org/apache/fop/fo/flow/TableCaption.java
index f73a8d936..051f48f32 100644
--- a/src/java/org/apache/fop/fo/flow/TableCaption.java
+++ b/src/java/org/apache/fop/fo/flow/TableCaption.java
@@ -20,13 +20,13 @@ package org.apache.fop.fo.flow;
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -74,7 +74,7 @@ public class TableCaption extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -91,7 +91,7 @@ public class TableCaption extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
@@ -100,7 +100,7 @@ public class TableCaption extends FObj {
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("marker* (%block;)");
}
@@ -111,7 +111,7 @@ public class TableCaption extends FObj {
* XSL Content Model: marker* (%block;)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (blockItemFound) {
nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
diff --git a/src/java/org/apache/fop/fo/flow/TableCell.java b/src/java/org/apache/fop/fo/flow/TableCell.java
index 2c86fc948..3d2dff26a 100644
--- a/src/java/org/apache/fop/fo/flow/TableCell.java
+++ b/src/java/org/apache/fop/fo/flow/TableCell.java
@@ -21,16 +21,15 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -118,7 +117,7 @@ public class TableCell extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -147,7 +146,7 @@ public class TableCell extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startCell(this);
}
@@ -157,7 +156,7 @@ public class TableCell extends FObj {
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (!blockItemFound) {
missingChildElementError("marker* (%block;)+");
}
@@ -169,7 +168,7 @@ public class TableCell extends FObj {
* XSL Content Model: marker* (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (blockItemFound) {
nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
diff --git a/src/java/org/apache/fop/fo/flow/TableColumn.java b/src/java/org/apache/fop/fo/flow/TableColumn.java
index 522225f43..1c37f6e96 100644
--- a/src/java/org/apache/fop/fo/flow/TableColumn.java
+++ b/src/java/org/apache/fop/fo/flow/TableColumn.java
@@ -20,14 +20,14 @@ package org.apache.fop.fo.flow;
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
@@ -57,7 +57,7 @@ public class TableColumn extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
// borderAfterPrecedence = pList.get(PR_BORDER_AFTER_PRECEDENCE);
// borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE);
@@ -73,14 +73,14 @@ public class TableColumn extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode()
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
getFOEventHandler().startColumn(this);
}
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endColumn(this);
}
@@ -89,7 +89,7 @@ public class TableColumn extends FObj {
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
diff --git a/src/java/org/apache/fop/fo/flow/TableRow.java b/src/java/org/apache/fop/fo/flow/TableRow.java
index 74a317155..daa51166c 100644
--- a/src/java/org/apache/fop/fo/flow/TableRow.java
+++ b/src/java/org/apache/fop/fo/flow/TableRow.java
@@ -21,15 +21,14 @@ package org.apache.fop.fo.flow;
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -74,7 +73,7 @@ public class TableRow extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange();
commonAural = pList.getAuralProps();
@@ -97,7 +96,7 @@ public class TableRow extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startRow(this);
}
@@ -105,7 +104,7 @@ public class TableRow extends FObj {
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("(table-cell+)");
}
@@ -117,7 +116,7 @@ public class TableRow extends FObj {
* XSL Content Model: (table-cell+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!(nsURI == FO_URI && localName.equals("table-cell"))) {
invalidChildError(loc, nsURI, localName);
}
diff --git a/src/java/org/apache/fop/fo/flow/Wrapper.java b/src/java/org/apache/fop/fo/flow/Wrapper.java
index 27cf815be..5a6008ef6 100644
--- a/src/java/org/apache/fop/fo/flow/Wrapper.java
+++ b/src/java/org/apache/fop/fo/flow/Wrapper.java
@@ -22,10 +22,7 @@ package org.apache.fop.fo.flow;
import java.util.List;
import java.util.ListIterator;
-// XML
-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.fo.PropertyList;
@@ -54,14 +51,14 @@ public class Wrapper extends FObjMixed {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
id = pList.get(PR_ID).getString();
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
diff --git a/src/java/org/apache/fop/fo/pagination/ColorProfile.java b/src/java/org/apache/fop/fo/pagination/ColorProfile.java
index fc62907ba..8ed04cee6 100644
--- a/src/java/org/apache/fop/fo/pagination/ColorProfile.java
+++ b/src/java/org/apache/fop/fo/pagination/ColorProfile.java
@@ -19,21 +19,20 @@
package org.apache.fop.fo.pagination;
// Java
-import java.awt.color.ICC_Profile;
import java.awt.color.ICC_ColorSpace;
-import java.net.URL;
+import java.awt.color.ICC_Profile;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
-// XML
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.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
/**
* The fo:color-profile formatting object.
@@ -58,7 +57,7 @@ public class ColorProfile extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
src = pList.get(PR_SRC).getString();
colorProfileName = pList.get(PR_COLOR_PROFILE_NAME).getString();
renderingIntent = pList.get(PR_RENDERING_INTENT).getEnum();
@@ -69,7 +68,7 @@ public class ColorProfile extends FObj {
XSL 1.0/FOP: EMPTY (no child nodes permitted)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
diff --git a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
index 8d9b4d0e8..a269fb6ed 100644
--- a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
+++ b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
@@ -20,12 +20,12 @@ package org.apache.fop.fo.pagination;
// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
/**
* A conditional-page-master-reference formatting object.
@@ -55,7 +55,7 @@ public class ConditionalPageMasterReference extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
masterReference = pList.get(PR_MASTER_REFERENCE).getString();
pagePosition = pList.get(PR_PAGE_POSITION).getEnum();
oddOrEven = pList.get(PR_ODD_OR_EVEN).getEnum();
@@ -65,7 +65,7 @@ public class ConditionalPageMasterReference extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
validateParent(parent);
}
@@ -74,7 +74,7 @@ public class ConditionalPageMasterReference extends FObj {
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
@@ -137,9 +137,9 @@ public class ConditionalPageMasterReference extends FObj {
* Check that the parent is the right type of formatting object
* repeatable-page-master-alternatives.
* @param parent parent node
- * @throws SAXParseException If the parent is invalid
+ * @throws ValidationException If the parent is invalid
*/
- protected void validateParent(FONode parent) throws SAXParseException {
+ protected void validateParent(FONode parent) throws ValidationException {
if (parent.getName().equals("fo:repeatable-page-master-alternatives")) {
this.repeatablePageMasterAlternatives =
(RepeatablePageMasterAlternatives)parent;
@@ -151,7 +151,7 @@ public class ConditionalPageMasterReference extends FObj {
this.repeatablePageMasterAlternatives.addConditionalPageMasterReference(this);
}
} else {
- throw new SAXParseException("fo:conditional-page-master-reference must be child "
+ throw new ValidationException("fo:conditional-page-master-reference must be child "
+ "of fo:repeatable-page-master-alternatives, not "
+ parent.getName(), locator);
}
diff --git a/src/java/org/apache/fop/fo/pagination/Declarations.java b/src/java/org/apache/fop/fo/pagination/Declarations.java
index 2556270bb..b66ea253a 100644
--- a/src/java/org/apache/fop/fo/pagination/Declarations.java
+++ b/src/java/org/apache/fop/fo/pagination/Declarations.java
@@ -19,18 +19,17 @@
package org.apache.fop.fo.pagination;
// Java
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Iterator;
-// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.XMLObj;
@@ -57,7 +56,7 @@ public class Declarations extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
// No properties defined for fo:declarations
}
@@ -67,7 +66,7 @@ public class Declarations extends FObj {
FOP/XSL 1.1: (color-profile)* (and non-XSL NS nodes)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI) {
if (!localName.equals("color-profile")) {
invalidChildError(loc, nsURI, localName);
@@ -79,7 +78,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() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
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 33f42ca90..4b3dc610d 100644
--- a/src/java/org/apache/fop/fo/pagination/Flow.java
+++ b/src/java/org/apache/fop/fo/pagination/Flow.java
@@ -22,14 +22,13 @@ package org.apache.fop.fo.pagination;
import java.util.ArrayList;
import java.util.List;
-// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.layoutmgr.FlowLayoutManager;
/**
@@ -59,16 +58,16 @@ public class Flow extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
flowName = pList.get(PR_FLOW_NAME).getString();
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
if (!parent.getName().equals("fo:page-sequence")) {
- throw new SAXParseException("flow must be child of "
+ throw new ValidationException("flow must be child of "
+ "page-sequence, not " + parent.getName(), locator);
}
@@ -101,7 +100,7 @@ public class Flow extends FObj {
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (!blockItemFound) {
missingChildElementError("marker* (%block;)+");
}
@@ -113,7 +112,7 @@ public class Flow extends FObj {
* XSL Content Model: marker* (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (blockItemFound) {
nodesOutOfOrderError(loc, "fo: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 d765b943d..eb571b7d5 100644
--- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
+++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
@@ -22,14 +22,13 @@ package org.apache.fop.fo.pagination;
import java.util.Iterator;
import java.util.Map;
-// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
/**
* The layout-master-set formatting object.
@@ -55,19 +54,19 @@ public class LayoutMasterSet extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
// No properties in layout-master-set.
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
if (parent.getName().equals("fo:root")) {
Root root = (Root)parent;
root.setLayoutMasterSet(this);
} else {
- throw new SAXParseException("fo:layout-master-set must be child of fo:root, not "
+ throw new ValidationException("fo:layout-master-set must be child of fo:root, not "
+ parent.getName(), locator);
}
simplePageMasters = new java.util.HashMap();
@@ -77,7 +76,7 @@ public class LayoutMasterSet extends FObj {
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("(simple-page-master|page-sequence-master)+");
}
@@ -89,7 +88,7 @@ public class LayoutMasterSet extends FObj {
XSL/FOP: (simple-page-master|page-sequence-master)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI) {
if (!localName.equals("simple-page-master")
&& !localName.equals("page-sequence-master")) {
@@ -103,9 +102,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 SAXParseException if there's a name duplication
+ * @throws ValidationException if there's a name duplication
*/
- private void checkRegionNames() throws SAXParseException {
+ private void checkRegionNames() throws ValidationException {
// (user-entered) region-name to default region map.
Map allRegions = new java.util.HashMap();
for (Iterator spm = simplePageMasters.values().iterator();
@@ -120,7 +119,7 @@ public class LayoutMasterSet extends FObj {
String defaultRegionName =
(String) allRegions.get(region.getRegionName());
if (!defaultRegionName.equals(region.getDefaultRegionName())) {
- throw new SAXParseException("Region-name ("
+ throw new ValidationException("Region-name ("
+ region.getRegionName()
+ ") is being mapped to multiple "
+ "region-classes ("
@@ -139,15 +138,15 @@ public class LayoutMasterSet extends FObj {
* Add a simple page master.
* The name is checked to throw an error if already added.
* @param sPM simple-page-master to add
- * @throws SAXParseException if there's a problem with name uniqueness
+ * @throws ValidationException if there's a problem with name uniqueness
*/
protected void addSimplePageMaster(SimplePageMaster sPM)
- throws SAXParseException {
+ throws ValidationException {
// check for duplication of master-name
String masterName = sPM.getMasterName();
if (existsName(masterName)) {
- throw new SAXParseException("'master-name' ("
+ throw new ValidationException("'master-name' ("
+ masterName
+ ") must be unique "
+ "across page-masters and page-sequence-masters", sPM.locator);
@@ -180,14 +179,14 @@ public class LayoutMasterSet extends FObj {
* The name is checked to throw an error if already added.
* @param masterName name for the master
* @param pSM PageSequenceMaster instance
- * @throws SAXParseException if there's a problem with name uniqueness
+ * @throws ValidationException if there's a problem with name uniqueness
*/
protected void addPageSequenceMaster(String masterName,
PageSequenceMaster pSM)
- throws SAXParseException {
+ throws ValidationException {
// check against duplication of master-name
if (existsName(masterName)) {
- throw new SAXParseException("'master-name' ("
+ throw new ValidationException("'master-name' ("
+ masterName
+ ") must be unique "
+ "across page-masters and page-sequence-masters", pSM.locator);
diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java
index 8478cfcff..6cf181373 100644
--- a/src/java/org/apache/fop/fo/pagination/PageSequence.java
+++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java
@@ -21,14 +21,13 @@ package org.apache.fop.fo.pagination;
// Java
import java.util.HashMap;
-// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.Property;
/**
@@ -135,7 +134,7 @@ public class PageSequence extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
country = pList.get(PR_COUNTRY).getString();
format = pList.get(PR_FORMAT).getString();
language = pList.get(PR_LANGUAGE).getString();
@@ -151,7 +150,7 @@ public class PageSequence extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode()
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
this.root = (Root) parent;
layoutMasterSet = root.getLayoutMasterSet();
flowMap = new HashMap();
@@ -174,7 +173,7 @@ public class PageSequence extends FObj {
this.pageSequenceMaster =
this.layoutMasterSet.getPageSequenceMaster(masterReference);
if (this.pageSequenceMaster == null) {
- throw new SAXParseException("master-reference '" + masterReference
+ throw new ValidationException("master-reference '" + masterReference
+ "' for fo:page-sequence matches no"
+ " simple-page-master or page-sequence-master", locator);
}
@@ -195,7 +194,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() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (mainFlow == null) {
missingChildElementError("(title?,static-content*,flow)");
}
@@ -208,7 +207,7 @@ public class PageSequence extends FObj {
XSL Content Model: (title?,static-content*,flow)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI) {
if (localName.equals("title")) {
if (titleFO != null) {
@@ -239,7 +238,7 @@ public class PageSequence extends FObj {
* @todo see if addChildNode() should also be called for fo's other than
* fo:flow.
*/
- public void addChildNode(FONode child) throws SAXParseException {
+ public void addChildNode(FONode child) throws FOPException {
int childId = child.getNameId();
if (childId == FO_TITLE) {
@@ -263,11 +262,11 @@ public class PageSequence extends FObj {
* based on the region-names given to the regions in the page-master
* used to generate that page.
*/
- private void addFlow(Flow flow) throws SAXParseException {
+ private void addFlow(Flow flow) throws ValidationException {
String flowName = flow.getFlowName();
if (hasFlowName(flowName)) {
- throw new SAXParseException ("duplicate flow-name \""
+ throw new ValidationException("duplicate flow-name \""
+ flowName
+ "\" found within fo:page-sequence", flow.locator);
}
@@ -275,7 +274,7 @@ public class PageSequence extends FObj {
if (!layoutMasterSet.regionNameExists(flowName)
&& !flowName.equals("xsl-before-float-separator")
&& !flowName.equals("xsl-footnote-separator")) {
- throw new SAXParseException ("flow-name \""
+ throw new ValidationException("flow-name \""
+ flowName
+ "\" could not be mapped to a region-name in the"
+ " layout-master-set", flow.locator);
diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
index a6713ad2f..bda91aa1d 100644
--- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
+++ b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
@@ -21,15 +21,13 @@ 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.FObj;
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
-import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.ValidationException;
/**
* The page-sequence-master formatting object.
@@ -63,14 +61,14 @@ public class PageSequenceMaster extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
masterName = pList.get(PR_MASTER_NAME).getString();
}
/**
* @see org.apache.fop.fo.FONode#startOfNode()
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
subSequenceSpecifiers = new java.util.ArrayList();
if (parent.getName().equals("fo:layout-master-set")) {
this.layoutMasterSet = (LayoutMasterSet)parent;
@@ -81,7 +79,7 @@ public class PageSequenceMaster extends FObj {
this.layoutMasterSet.addPageSequenceMaster(masterName, this);
}
} else {
- throw new SAXParseException("fo:page-sequence-master must be child "
+ throw new ValidationException("fo:page-sequence-master must be child "
+ "of fo:layout-master-set, not "
+ parent.getName(), locator);
}
@@ -90,7 +88,7 @@ public class PageSequenceMaster extends FObj {
/**
* @see org.apache.fop.fo.FONode#endOfNode()
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("(single-page-master-reference|" +
"repeatable-page-master-reference|repeatable-page-master-alternatives)+");
@@ -103,7 +101,7 @@ public class PageSequenceMaster extends FObj {
* repeatable-page-master-alternatives)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI) {
if (!localName.equals("single-page-master-reference")
&& !localName.equals("repeatable-page-master-reference")
diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java
index 35da2f03b..c92404c77 100644
--- a/src/java/org/apache/fop/fo/pagination/Region.java
+++ b/src/java/org/apache/fop/fo/pagination/Region.java
@@ -20,16 +20,15 @@ package org.apache.fop.fo.pagination;
import java.awt.Rectangle;
-// XML
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.datatypes.Numeric;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
@@ -59,7 +58,7 @@ public abstract class Region extends FObj {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
// clip = pList.get(PR_CLIP);
displayAlign = pList.get(PR_DISPLAY_ALIGN).getEnum();
@@ -75,7 +74,7 @@ public abstract class Region extends FObj {
// check that name is OK. Not very pretty.
if (isReserved(getRegionName())
&& !getRegionName().equals(getDefaultRegionName())) {
- throw new SAXParseException("region-name '" + regionName
+ throw new ValidationException("region-name '" + regionName
+ "' for " + this.getName()
+ " is not permitted.", locator);
}
@@ -87,7 +86,7 @@ public abstract class Region extends FObj {
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
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 5b9df542d..227104e34 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionBA.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionBA.java
@@ -21,10 +21,7 @@ package org.apache.fop.fo.pagination;
// Java
import java.awt.Rectangle;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
@@ -48,7 +45,7 @@ public abstract class RegionBA extends Region {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
extent = pList.get(PR_EXTENT).getLength();
precedence = pList.get(PR_PRECEDENCE).getEnum();
diff --git a/src/java/org/apache/fop/fo/pagination/RegionBody.java b/src/java/org/apache/fop/fo/pagination/RegionBody.java
index 3ed0adeb9..0f7a26464 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionBody.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionBody.java
@@ -21,10 +21,7 @@ package org.apache.fop.fo.pagination;
// Java
import java.awt.Rectangle;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.FODimension;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
@@ -52,7 +49,7 @@ public class RegionBody extends Region {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
commonMarginBlock = pList.getMarginBlockProps();
columnCount = pList.get(PR_COLUMN_COUNT).getNumeric();
diff --git a/src/java/org/apache/fop/fo/pagination/RegionSE.java b/src/java/org/apache/fop/fo/pagination/RegionSE.java
index 584a5996d..d75db5f68 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionSE.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionSE.java
@@ -21,10 +21,7 @@ package org.apache.fop.fo.pagination;
// Java
import java.awt.Rectangle;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
@@ -47,7 +44,7 @@ public abstract class RegionSE extends Region {
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
extent = pList.get(PR_EXTENT).getLength();
}
diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
index 654bd733d..566397fce 100644
--- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
+++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
@@ -21,14 +21,13 @@ package org.apache.fop.fo.pagination;
// Java
import java.util.ArrayList;
-// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.Property;
/**
@@ -59,21 +58,21 @@ public class RepeatablePageMasterAlternatives extends FObj
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
maximumRepeats = pList.get(PR_MAXIMUM_REPEATS);
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
conditionalPageMasterRefs = new ArrayList();
if (parent.getName().equals("fo:page-sequence-master")) {
PageSequenceMaster pageSequenceMaster = (PageSequenceMaster)parent;
pageSequenceMaster.addSubsequenceSpecifier(this);
} else {
- throw new SAXParseException("fo:repeatable-page-master-alternatives "
+ throw new ValidationException("fo:repeatable-page-master-alternatives "
+ "must be child of fo:page-sequence-master, not "
+ parent.getName(), locator);
}
@@ -82,7 +81,7 @@ public class RepeatablePageMasterAlternatives extends FObj
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("(conditional-page-master-reference+)");
}
@@ -93,7 +92,7 @@ public class RepeatablePageMasterAlternatives extends FObj
XSL/FOP: (conditional-page-master-reference+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!(nsURI == FO_URI &&
localName.equals("conditional-page-master-reference"))) {
invalidChildError(loc, nsURI, localName);
diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
index 21b6af66d..860ae58c0 100644
--- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
+++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
@@ -20,12 +20,12 @@ package org.apache.fop.fo.pagination;
// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.Property;
/**
@@ -56,7 +56,7 @@ public class RepeatablePageMasterReference extends FObj
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
masterReference = pList.get(PR_MASTER_REFERENCE).getString();
maximumRepeats = pList.get(PR_MAXIMUM_REPEATS);
}
@@ -64,7 +64,7 @@ public class RepeatablePageMasterReference extends FObj
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent;
if (masterReference == null) {
@@ -79,7 +79,7 @@ public class RepeatablePageMasterReference extends FObj
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
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 000173540..a38342573 100644
--- a/src/java/org/apache/fop/fo/pagination/Root.java
+++ b/src/java/org/apache/fop/fo/pagination/Root.java
@@ -21,17 +21,16 @@ 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.apps.FOPException;
+import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.extensions.ExtensionElementMapping;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.extensions.Bookmarks;
+import org.apache.fop.fo.extensions.ExtensionElementMapping;
/**
* The fo:root formatting object. Contains page masters, page-sequences.
@@ -81,7 +80,7 @@ public class Root extends FObj {
/**
* Signal end of this xml element.
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (!pageSequenceFound || layoutMasterSet == null) {
missingChildElementError("(layout-master-set, declarations?, " +
"fox:bookmarks?, page-sequence+)");
@@ -94,7 +93,7 @@ public class Root extends FObj {
FOP: (layout-master-set, declarations?, fox:bookmarks?, page-sequence+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI) {
if (localName.equals("layout-master-set")) {
if (layoutMasterSet != null) {
diff --git a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
index 0bb663e84..8a8ef1c5d 100644
--- a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
+++ b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
@@ -23,16 +23,15 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonMarginBlock;
/**
@@ -72,7 +71,7 @@ public class SimplePageMaster extends FObj {
/**
* @see org.apache.fop.fo.FObj#resolve
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonMarginBlock = pList.getMarginBlockProps();
masterName = pList.get(PR_MASTER_NAME).getString();
pageHeight = pList.get(PR_PAGE_HEIGHT).getLength();
@@ -84,7 +83,7 @@ public class SimplePageMaster extends FObj {
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
LayoutMasterSet layoutMasterSet = (LayoutMasterSet) parent;
if (masterName == null) {
@@ -101,7 +100,7 @@ public class SimplePageMaster extends FObj {
* Make sure content model satisfied.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (!hasRegionBody) {
missingChildElementError("(region-body, region-before?," +
" region-after?, region-start?, region-end?)");
@@ -113,7 +112,7 @@ public class SimplePageMaster extends FObj {
* XSL Content Model: (region-body,region-before?,region-after?,region-start?,region-end?)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("region-body")) {
if (hasRegionBody) {
tooManyNodesError(loc, "fo:region-body");
diff --git a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java
index 7507a5233..be5444801 100644
--- a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java
+++ b/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java
@@ -20,12 +20,12 @@ package org.apache.fop.fo.pagination;
// XML
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.PropertyList;
+import org.apache.fop.fo.ValidationException;
/**
* A single-page-master-reference formatting object.
@@ -55,14 +55,14 @@ public class SinglePageMasterReference extends FObj
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
masterReference = pList.get(PR_MASTER_REFERENCE).getString();
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent;
if (masterReference == null) {
missingPropertyError("master-reference");
@@ -76,7 +76,7 @@ public class SinglePageMasterReference extends FObj
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
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 98364c5dc..506467807 100644
--- a/src/java/org/apache/fop/fo/pagination/StaticContent.java
+++ b/src/java/org/apache/fop/fo/pagination/StaticContent.java
@@ -20,10 +20,10 @@ package org.apache.fop.fo.pagination;
// XML
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.ValidationException;
/**
* Class modelling the fo:static-content object.
@@ -40,9 +40,9 @@ public class StaticContent extends Flow {
/**
* @see org.apache.fop.fo.FONode#startOfNode()
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
if (getFlowName() == null || getFlowName().equals("")) {
- throw new SAXParseException("A 'flow-name' is required for "
+ throw new ValidationException("A 'flow-name' is required for "
+ getName() + ".", locator);
}
getFOEventHandler().startFlow(this);
@@ -53,7 +53,7 @@ public class StaticContent extends Flow {
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("(%block;)+");
}
@@ -65,7 +65,7 @@ public class StaticContent extends Flow {
* XSL Content Model: (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!isBlockItem(nsURI, localName)) {
invalidChildError(loc, nsURI, localName);
}
diff --git a/src/java/org/apache/fop/fo/pagination/Title.java b/src/java/org/apache/fop/fo/pagination/Title.java
index afe49a775..03ca47ca5 100644
--- a/src/java/org/apache/fop/fo/pagination/Title.java
+++ b/src/java/org/apache/fop/fo/pagination/Title.java
@@ -20,14 +20,14 @@ package org.apache.fop.fo.pagination;
// XML
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.FObjMixed;
import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -55,7 +55,7 @@ public class Title extends FObjMixed {
super(parent);
}
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
@@ -71,7 +71,7 @@ public class Title extends FObjMixed {
XSL/FOP: (#PCDATA|%inline;)*
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!isInlineItem(nsURI, localName)) {
invalidChildError(loc, nsURI, localName);
}
diff --git a/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java b/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java
index dab904645..84e5122fb 100644
--- a/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java
+++ b/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java
@@ -18,9 +18,9 @@
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* This subclass of LengthProperty.Maker handles the special treatment of
@@ -54,7 +54,7 @@ public class BorderWidthPropertyMaker extends LengthProperty.Maker {
public Property get(int subpropId, PropertyList propertyList,
boolean bTryInherit, boolean bTryDefault)
- throws FOPException
+ throws PropertyException
{
Property p = super.get(subpropId, propertyList,
bTryInherit, bTryDefault);
diff --git a/src/java/org/apache/fop/fo/properties/BoxPropShorthandParser.java b/src/java/org/apache/fop/fo/properties/BoxPropShorthandParser.java
index 5e0d079ca..f0fc32255 100644
--- a/src/java/org/apache/fop/fo/properties/BoxPropShorthandParser.java
+++ b/src/java/org/apache/fop/fo/properties/BoxPropShorthandParser.java
@@ -20,6 +20,7 @@ package org.apache.fop.fo.properties;
import org.apache.fop.fo.FOPropertyMapping;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Shorthand property parser for Box properties
@@ -42,7 +43,9 @@ public class BoxPropShorthandParser extends GenericShorthandParser {
protected Property convertValueForProperty(int propId,
ListProperty listProperty,
PropertyMaker maker,
- PropertyList propertyList) {
+ PropertyList propertyList)
+ throws PropertyException
+ {
String name = FOPropertyMapping.getPropertyName(propId);
Property p = null;
int count = listProperty.getList().size();
diff --git a/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java b/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java
index a9e85f202..010574049 100644
--- a/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java
+++ b/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java
@@ -21,6 +21,7 @@ package org.apache.fop.fo.properties;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Store all common absolute position properties.
@@ -57,7 +58,7 @@ public class CommonAbsolutePosition {
* Create a CommonAbsolutePosition object.
* @param pList The PropertyList with propery values.
*/
- public CommonAbsolutePosition(PropertyList pList) {
+ public CommonAbsolutePosition(PropertyList pList) throws PropertyException {
absolutePosition = pList.get(Constants.PR_ABSOLUTE_POSITION).getEnum();
top = pList.get(Constants.PR_TOP).getLength();
bottom = pList.get(Constants.PR_BOTTOM).getLength();
diff --git a/src/java/org/apache/fop/fo/properties/CommonAccessibility.java b/src/java/org/apache/fop/fo/properties/CommonAccessibility.java
index 333099b9f..7bf382070 100644
--- a/src/java/org/apache/fop/fo/properties/CommonAccessibility.java
+++ b/src/java/org/apache/fop/fo/properties/CommonAccessibility.java
@@ -20,6 +20,7 @@ package org.apache.fop.fo.properties;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Store all common accessibility properties.
@@ -41,7 +42,7 @@ public class CommonAccessibility {
* Create a CommonAbsolutePosition object.
* @param pList The PropertyList with propery values.
*/
- public CommonAccessibility(PropertyList pList) {
+ public CommonAccessibility(PropertyList pList) throws PropertyException {
sourceDoc = pList.get(Constants.PR_SOURCE_DOCUMENT).getString();
if ("none".equals(sourceDoc)) {
sourceDoc = null;
diff --git a/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java b/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
index 1fee10090..ce6bd47a1 100755
--- a/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
+++ b/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
@@ -22,6 +22,7 @@ import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Stores all common border and padding properties.
@@ -82,7 +83,7 @@ public class CommonBorderPaddingBackground implements Cloneable {
* Construct a CommonBorderPaddingBackground object.
* @param pList The PropertyList to get properties from.
*/
- public CommonBorderPaddingBackground(PropertyList pList) {
+ public CommonBorderPaddingBackground(PropertyList pList) throws PropertyException {
backgroundAttachment = pList.get(Constants.PR_BACKGROUND_ATTACHMENT).getEnum();
backgroundColor = pList.get(Constants.PR_BACKGROUND_COLOR).getColorType();
if (backgroundColor.getAlpha() == 0) {
@@ -122,7 +123,8 @@ public class CommonBorderPaddingBackground implements Cloneable {
}
private void initBorderInfo(PropertyList pList, int side,
- int colorProp, int styleProp, int widthProp, int paddingProp)
+ int colorProp, int styleProp, int widthProp, int paddingProp)
+ throws PropertyException
{
padding[side] = pList.get(paddingProp).getCondLength();
// If style = none, force width to 0, don't get Color (spec 7.7.20)
diff --git a/src/java/org/apache/fop/fo/properties/CommonFont.java b/src/java/org/apache/fop/fo/properties/CommonFont.java
index ba56e7aa5..30e9ea09d 100755
--- a/src/java/org/apache/fop/fo/properties/CommonFont.java
+++ b/src/java/org/apache/fop/fo/properties/CommonFont.java
@@ -23,6 +23,7 @@ import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontMetrics;
@@ -78,7 +79,7 @@ public class CommonFont {
* Create a CommonFont object.
* @param pList The PropertyList to get properties from.
*/
- public CommonFont(PropertyList pList) {
+ public CommonFont(PropertyList pList) throws PropertyException {
fontFamily = pList.get(Constants.PR_FONT_FAMILY).getString();
fontSelectionStrategy = pList.get(Constants.PR_FONT_SELECTION_STRATEGY).getEnum();
fontSize = pList.get(Constants.PR_FONT_SIZE).getLength();
diff --git a/src/java/org/apache/fop/fo/properties/CommonHyphenation.java b/src/java/org/apache/fop/fo/properties/CommonHyphenation.java
index 82b87059c..660b864ba 100644
--- a/src/java/org/apache/fop/fo/properties/CommonHyphenation.java
+++ b/src/java/org/apache/fop/fo/properties/CommonHyphenation.java
@@ -20,6 +20,7 @@ package org.apache.fop.fo.properties;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Store all common hyphenation properties.
@@ -66,7 +67,7 @@ public class CommonHyphenation {
* Create a CommonHyphenation object.
* @param pList The PropertyList with propery values.
*/
- public CommonHyphenation(PropertyList pList) {
+ public CommonHyphenation(PropertyList pList) throws PropertyException {
language = pList.get(Constants.PR_LANGUAGE).getString();
country = pList.get(Constants.PR_COUNTRY).getString();
hyphenate = pList.get(Constants.PR_HYPHENATE).getEnum();
diff --git a/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java b/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java
index 5c4fc16d8..5b7e89bf5 100644
--- a/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java
+++ b/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java
@@ -21,6 +21,7 @@ package org.apache.fop.fo.properties;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Store all common margin properties for blocks.
@@ -72,7 +73,7 @@ public class CommonMarginBlock {
* Create a CommonMarginBlock object.
* @param pList The PropertyList with propery values.
*/
- public CommonMarginBlock(PropertyList pList) {
+ public CommonMarginBlock(PropertyList pList) throws PropertyException {
marginTop = pList.get(Constants.PR_MARGIN_TOP).getLength();
marginBottom = pList.get(Constants.PR_MARGIN_BOTTOM).getLength();
marginLeft = pList.get(Constants.PR_MARGIN_LEFT).getLength();
diff --git a/src/java/org/apache/fop/fo/properties/CommonMarginInline.java b/src/java/org/apache/fop/fo/properties/CommonMarginInline.java
index 1597e6752..4a5353f33 100644
--- a/src/java/org/apache/fop/fo/properties/CommonMarginInline.java
+++ b/src/java/org/apache/fop/fo/properties/CommonMarginInline.java
@@ -21,6 +21,7 @@ package org.apache.fop.fo.properties;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Store all common margin properties for inlines.
@@ -63,7 +64,7 @@ public class CommonMarginInline {
* Create a CommonMarginInline object.
* @param pList The PropertyList with propery values.
*/
- public CommonMarginInline(PropertyList pList) {
+ public CommonMarginInline(PropertyList pList) throws PropertyException {
marginTop = pList.get(Constants.PR_MARGIN_TOP).getLength();
marginBottom = pList.get(Constants.PR_MARGIN_BOTTOM).getLength();
marginLeft = pList.get(Constants.PR_MARGIN_LEFT).getLength();
diff --git a/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java b/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java
index f400c8272..e8178ada8 100644
--- a/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java
+++ b/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java
@@ -21,6 +21,7 @@ package org.apache.fop.fo.properties;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Store all common relative position properties.
@@ -57,7 +58,7 @@ public class CommonRelativePosition {
* Create a CommonRelativePosition object.
* @param pList The PropertyList with propery values.
*/
- public CommonRelativePosition(PropertyList pList) {
+ public CommonRelativePosition(PropertyList pList) throws PropertyException {
relativePosition = pList.get(Constants.PR_RELATIVE_POSITION).getEnum();
top = pList.get(Constants.PR_TOP).getLength();
bottom = pList.get(Constants.PR_BOTTOM).getLength();
diff --git a/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java b/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java
index bcb686bc5..ab09b266d 100644
--- a/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java
+++ b/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java
@@ -18,11 +18,11 @@
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.CompoundDatatype;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* @author me
@@ -145,7 +145,7 @@ public class CompoundPropertyMaker extends PropertyMaker {
*/
public Property get(int subpropId, PropertyList propertyList,
boolean bTryInherit, boolean bTryDefault)
- throws FOPException
+ throws PropertyException
{
Property p = super.get(subpropId, propertyList, bTryInherit, bTryDefault);
if (subpropId != 0 && p != null) {
@@ -163,11 +163,11 @@ public class CompoundPropertyMaker extends PropertyMaker {
* @param fo The parent FO for the FO whose property is being made.
* @return A Property of the correct type or null if the parsed value
* can't be converted to the correct type.
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException for invalid or inconsistent FO input
*/
protected Property convertProperty(Property p,
PropertyList propertyList,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
if (!EnumProperty.class.isAssignableFrom(p.getClass())) {
// delegate to the subprop maker to do conversions
p = shorthandMaker.convertProperty(p, propertyList, fo);
@@ -191,9 +191,9 @@ public class CompoundPropertyMaker extends PropertyMaker {
* Make a compound property with default values.
* @param propertyList The PropertyList object being built for this FO.
* @return the Property object corresponding to the parameters
- * @throws FOPException for invalid or inconsisten FO input
+ * @throws PropertyException for invalid or inconsisten FO input
*/
- public Property make(PropertyList propertyList) throws FOPException {
+ public Property make(PropertyList propertyList) throws PropertyException {
if (defaultValue != null) {
return make(propertyList, defaultValue, propertyList.getParentFObj());
} else {
@@ -207,10 +207,10 @@ public class CompoundPropertyMaker extends PropertyMaker {
* @param value The attribute value.
* @param fo The parent FO for the FO whose property is being made.
* @return The initialized Property object.
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException for invalid or inconsistent FO input
*/
public Property make(PropertyList propertyList, String value,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
Property p = super.make(propertyList, value, fo);
p = convertProperty(p, propertyList, fo);
return p;
@@ -228,11 +228,11 @@ public class CompoundPropertyMaker extends PropertyMaker {
* @param value the value of the
* @return baseProp (or if null, a new compound property object) with
* the new subproperty added
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException for invalid or inconsistent FO input
*/
public Property make(Property baseProp, int subpropId,
PropertyList propertyList, String value,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
if (baseProp == null) {
baseProp = makeCompound(propertyList, fo);
}
@@ -258,10 +258,10 @@ public class CompoundPropertyMaker extends PropertyMaker {
* @param parentFO The parent FO for the FO whose property is being made.
* @return a Property subclass object holding a "compound" property object
* initialized to the default values for each component.
- * @throws FOPException
+ * @throws PropertyException
*/
protected Property makeCompound(PropertyList propertyList, FObj parentFO)
- throws FOPException
+ throws PropertyException
{
Property p = makeNewProperty();
CompoundDatatype data = (CompoundDatatype) p.getObject();
diff --git a/src/java/org/apache/fop/fo/properties/CondLengthProperty.java b/src/java/org/apache/fop/fo/properties/CondLengthProperty.java
index 91e89964e..9238996bb 100644
--- a/src/java/org/apache/fop/fo/properties/CondLengthProperty.java
+++ b/src/java/org/apache/fop/fo/properties/CondLengthProperty.java
@@ -18,12 +18,12 @@
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.CompoundDatatype;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Superclass for properties that have conditional lengths
@@ -56,7 +56,7 @@ public class CondLengthProperty extends Property implements CompoundDatatype {
* @see CompoundPropertyMaker#convertProperty
*/
public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
- throws FOPException
+ throws PropertyException
{
if (p instanceof KeepProperty) {
return p;
diff --git a/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java b/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java
index 96dcbe5e4..a3f0a4223 100644
--- a/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java
+++ b/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java
@@ -21,6 +21,7 @@ package org.apache.fop.fo.properties;
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
*/
@@ -94,7 +95,7 @@ public class CorrespondingPropertyMaker {
* are specified (in foproperties.xml) to compute the value.
* @throws FOPException for invalid or inconsistent FO input
*/
- public Property compute(PropertyList propertyList) throws FOPException {
+ public Property compute(PropertyList propertyList) throws PropertyException {
PropertyList pList = getWMPropertyList(propertyList);
if (pList == null) {
return null;
diff --git a/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java b/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java
index c228f256c..c5ff73b55 100644
--- a/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java
+++ b/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java
@@ -18,9 +18,9 @@
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* @author me
@@ -50,7 +50,7 @@ public class DimensionPropertyMaker extends CorrespondingPropertyMaker {
return false;
}
- public Property compute(PropertyList propertyList) throws FOPException {
+ public Property compute(PropertyList propertyList) throws PropertyException {
// Based on [width|height]
Property p = super.compute(propertyList);
if (p == null) {
diff --git a/src/java/org/apache/fop/fo/properties/EnumProperty.java b/src/java/org/apache/fop/fo/properties/EnumProperty.java
index 32f7dbb00..0e1a90bf2 100644
--- a/src/java/org/apache/fop/fo/properties/EnumProperty.java
+++ b/src/java/org/apache/fop/fo/properties/EnumProperty.java
@@ -18,9 +18,9 @@
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Superclass for properties that wrap an enumeration value
@@ -52,7 +52,7 @@ public class EnumProperty extends Property {
public Property convertProperty(Property p,
PropertyList propertyList,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
if (p instanceof EnumProperty) {
return p;
} else {
diff --git a/src/java/org/apache/fop/fo/properties/GenericShorthandParser.java b/src/java/org/apache/fop/fo/properties/GenericShorthandParser.java
index c8b92f642..47146e257 100644
--- a/src/java/org/apache/fop/fo/properties/GenericShorthandParser.java
+++ b/src/java/org/apache/fop/fo/properties/GenericShorthandParser.java
@@ -19,7 +19,9 @@
package org.apache.fop.fo.properties;
import java.util.Enumeration;
+
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
public class GenericShorthandParser implements ShorthandParser {
@@ -46,7 +48,9 @@ public class GenericShorthandParser implements ShorthandParser {
public Property getValueForProperty(int propId,
Property property,
PropertyMaker maker,
- PropertyList propertyList) {
+ PropertyList propertyList)
+ throws PropertyException
+ {
Property prop = null;
// Check for keyword "inherit"
if (property.getList().size() == 1) {
@@ -70,7 +74,9 @@ public class GenericShorthandParser implements ShorthandParser {
protected Property convertValueForProperty(int propId,
Property property,
PropertyMaker maker,
- PropertyList propertyList) {
+ PropertyList propertyList)
+ throws PropertyException
+ {
Property prop = null;
// Try each of the stored values in turn
Enumeration eprop = property.getList().elements();
diff --git a/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java b/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java
index ed679cb4b..848b47981 100644
--- a/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java
+++ b/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java
@@ -18,11 +18,10 @@
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Numeric;
-import org.apache.fop.fo.FOPropertyMapping;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.NumericOp;
+import org.apache.fop.fo.expr.PropertyException;
/**
* This property maker handles the calculations described in 5.3.2 which
@@ -68,45 +67,42 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker {
* Calculate the corresponding value for start-indent and end-indent.
* @see CorrespondingPropertyMaker#compute(PropertyList)
*/
- public Property compute(PropertyList propertyList) throws FOPException {
+ public Property compute(PropertyList propertyList) throws PropertyException {
PropertyList pList = getWMPropertyList(propertyList);
// Calculate the values as described in 5.3.2.
- try {
- int marginProp = pList.getWritingMode(lr_tb, rl_tb, tb_rl);
- Numeric margin;
+
+ int marginProp = pList.getWritingMode(lr_tb, rl_tb, tb_rl);
+ Numeric margin;
// Calculate the absolute margin.
- if (propertyList.getExplicitOrShorthand(marginProp) == null) {
- Property indent = propertyList.getExplicit(baseMaker.propId);
- if (indent == null) {
- margin = new FixedLength(0);
- } else {
- margin = propertyList.getExplicit(baseMaker.propId).getNumeric();
- margin = NumericOp.subtraction(margin, propertyList.getInherited(baseMaker.propId).getNumeric());
- }
- margin = NumericOp.subtraction(margin, getCorresponding(paddingCorresponding, propertyList).getNumeric());
- margin = NumericOp.subtraction(margin, getCorresponding(borderWidthCorresponding, propertyList).getNumeric());
+ if (propertyList.getExplicitOrShorthand(marginProp) == null) {
+ Property indent = propertyList.getExplicit(baseMaker.propId);
+ if (indent == null) {
+ margin = new FixedLength(0);
} else {
- margin = propertyList.get(marginProp).getNumeric();
- }
-
- Numeric v = new FixedLength(0);
- if (!propertyList.getFObj().generatesReferenceAreas()) {
- // The inherited_value_of([start|end]-indent)
- v = NumericOp.addition(v, propertyList.getInherited(baseMaker.propId).getNumeric());
+ margin = propertyList.getExplicit(baseMaker.propId).getNumeric();
+ margin = NumericOp.subtraction(margin, propertyList.getInherited(baseMaker.propId).getNumeric());
}
- // The corresponding absolute margin-[right|left}.
- v = NumericOp.addition(v, margin);
- v = NumericOp.addition(v, getCorresponding(paddingCorresponding, propertyList).getNumeric());
- v = NumericOp.addition(v, getCorresponding(borderWidthCorresponding, propertyList).getNumeric());
- return (Property) v;
- } catch (org.apache.fop.fo.expr.PropertyException propEx) {
- String propName = FOPropertyMapping.getPropertyName(baseMaker.getPropId());
- throw new FOPException("Error in " + propName
- + " calculation " + propEx);
- }
+ margin = NumericOp.subtraction(margin, getCorresponding(paddingCorresponding, propertyList).getNumeric());
+ margin = NumericOp.subtraction(margin, getCorresponding(borderWidthCorresponding, propertyList).getNumeric());
+ } else {
+ margin = propertyList.get(marginProp).getNumeric();
+ }
+
+ Numeric v = new FixedLength(0);
+ if (!propertyList.getFObj().generatesReferenceAreas()) {
+ // The inherited_value_of([start|end]-indent)
+ v = NumericOp.addition(v, propertyList.getInherited(baseMaker.propId).getNumeric());
+ }
+ // The corresponding absolute margin-[right|left}.
+ v = NumericOp.addition(v, margin);
+ v = NumericOp.addition(v, getCorresponding(paddingCorresponding, propertyList).getNumeric());
+ v = NumericOp.addition(v, getCorresponding(borderWidthCorresponding, propertyList).getNumeric());
+ return (Property) v;
}
- private Property getCorresponding(int[] corresponding, PropertyList propertyList) {
+ private Property getCorresponding(int[] corresponding, PropertyList propertyList)
+ throws PropertyException
+ {
PropertyList pList = getWMPropertyList(propertyList);
int wmcorr = pList.getWritingMode(corresponding[0], corresponding[1], corresponding[2]);
return propertyList.get(wmcorr);
diff --git a/src/java/org/apache/fop/fo/properties/KeepProperty.java b/src/java/org/apache/fop/fo/properties/KeepProperty.java
index ecf8e92e6..e0a92886a 100644
--- a/src/java/org/apache/fop/fo/properties/KeepProperty.java
+++ b/src/java/org/apache/fop/fo/properties/KeepProperty.java
@@ -18,10 +18,10 @@
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.CompoundDatatype;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Superclass for properties that wrap Keep values
@@ -55,7 +55,7 @@ public class KeepProperty extends Property implements CompoundDatatype {
* @see CompoundPropertyMaker#convertProperty
*/
public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
- throws FOPException
+ throws PropertyException
{
if (p instanceof KeepProperty) {
return p;
diff --git a/src/java/org/apache/fop/fo/properties/LengthPairProperty.java b/src/java/org/apache/fop/fo/properties/LengthPairProperty.java
index 6b2398db5..b782d9b06 100644
--- a/src/java/org/apache/fop/fo/properties/LengthPairProperty.java
+++ b/src/java/org/apache/fop/fo/properties/LengthPairProperty.java
@@ -18,10 +18,10 @@
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.CompoundDatatype;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Superclass for properties wrapping a LengthPair value
@@ -54,7 +54,7 @@ public class LengthPairProperty extends Property implements CompoundDatatype {
* @see CompoundPropertyMaker#convertProperty
*/
public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
- throws FOPException
+ throws PropertyException
{
if (p instanceof LengthPairProperty) {
return p;
diff --git a/src/java/org/apache/fop/fo/properties/LengthProperty.java b/src/java/org/apache/fop/fo/properties/LengthProperty.java
index e2697c9ba..145b5c38e 100644
--- a/src/java/org/apache/fop/fo/properties/LengthProperty.java
+++ b/src/java/org/apache/fop/fo/properties/LengthProperty.java
@@ -18,11 +18,11 @@
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Superclass for properties wrapping a Length value.
@@ -72,7 +72,7 @@ abstract public class LengthProperty extends Property
*/
public Property convertProperty(Property p,
PropertyList propertyList,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
Property prop = super.convertProperty(p, propertyList, fo);
if (prop != null) {
return prop;
diff --git a/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java b/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java
index a3429bfa5..8aa281aad 100644
--- a/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java
+++ b/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java
@@ -18,10 +18,10 @@
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.CompoundDatatype;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Superclass for properties that contain LengthRange values
@@ -60,7 +60,7 @@ public class LengthRangeProperty extends Property implements CompoundDatatype {
* @see CompoundPropertyMaker#convertProperty
*/
public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
- throws FOPException
+ throws PropertyException
{
if (p instanceof LengthRangeProperty) {
return p;
diff --git a/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java b/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java
index b1c3ae563..6c2da7dc3 100644
--- a/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java
+++ b/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java
@@ -18,7 +18,6 @@
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
@@ -47,7 +46,7 @@ public class LineHeightPropertyMaker extends SpaceProperty.Maker {
* @see PropertyMaker#make(PropertyList, String, FObj)
*/
public Property make(PropertyList propertyList, String value,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
Property p = super.make(propertyList, value, fo);
p.setSpecifiedValue(checkValueKeywords(value));
return p;
@@ -58,22 +57,15 @@ public class LineHeightPropertyMaker extends SpaceProperty.Maker {
* value.
* @see PropertyMaker#compute(PropertyList)
*/
- protected Property compute(PropertyList propertyList) throws FOPException {
+ protected Property compute(PropertyList propertyList) throws PropertyException {
// recalculate based on last specified value
// Climb up propertylist and find last spec'd value
Property specProp = propertyList.getNearestSpecified(propId);
if (specProp != null) {
String specVal = specProp.getSpecifiedValue();
if (specVal != null) {
- try {
- return make(propertyList, specVal,
+ return make(propertyList, specVal,
propertyList.getParentFObj());
- } catch (FOPException e) {
- //getLogger()error("Error computing property value for "
- // + propName + " from "
- // + specVal);
- return null;
- }
}
}
return null;
@@ -81,14 +73,10 @@ public class LineHeightPropertyMaker extends SpaceProperty.Maker {
public Property convertProperty(Property p,
PropertyList propertyList,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
Numeric numval = p.getNumeric();
if (numval != null && numval.getDimension() == 0) {
- try {
- p = new PercentLength(numval.getNumericValue(), getPercentBase(fo,propertyList));
- } catch (PropertyException exc) {
- // log.error("exception", exc);
- }
+ p = new PercentLength(numval.getNumericValue(), getPercentBase(fo,propertyList));
}
return super.convertProperty(p, propertyList, fo);
}
diff --git a/src/java/org/apache/fop/fo/properties/PercentLength.java b/src/java/org/apache/fop/fo/properties/PercentLength.java
index df57c7b4d..82c52adaf 100644
--- a/src/java/org/apache/fop/fo/properties/PercentLength.java
+++ b/src/java/org/apache/fop/fo/properties/PercentLength.java
@@ -19,12 +19,13 @@
package org.apache.fop.fo.properties;
import org.apache.fop.datatypes.PercentBase;
+import org.apache.fop.fo.expr.PropertyException;
/**
* a percent specified length quantity in XSL
*/
public class PercentLength extends LengthProperty {
-
+
/**
* The percentage itself, expressed as a decimal value, e.g. for 95%, set
* the value to .95
@@ -79,7 +80,12 @@ public class PercentLength extends LengthProperty {
* @see org.apache.fop.datatypes.Numeric#getNumericValue()
*/
public double getNumericValue() {
- return factor * lbase.getBaseLength();
+ try {
+ return factor * lbase.getBaseLength();
+ } catch (PropertyException exc) {
+ log.error(exc);
+ return 0;
+ }
}
/**
@@ -87,7 +93,7 @@ public class PercentLength extends LengthProperty {
* @see org.apache.fop.datatypes.Length#getValue()
*/
public int getValue() {
- return (int) (factor * lbase.getBaseLength());
+ return (int) getNumericValue();
}
/**
diff --git a/src/java/org/apache/fop/fo/properties/Property.java b/src/java/org/apache/fop/fo/properties/Property.java
index 6f5e5b4a7..b1c010f96 100644
--- a/src/java/org/apache/fop/fo/properties/Property.java
+++ b/src/java/org/apache/fop/fo/properties/Property.java
@@ -20,6 +20,9 @@ package org.apache.fop.fo.properties;
import java.util.Vector;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
@@ -28,6 +31,7 @@ import org.apache.fop.datatypes.Numeric;
* @author unascribed
*/
public class Property {
+ protected static Log log = LogFactory.getLog(PropertyMaker.class);
/**
* The original specified value for properties which inherit
diff --git a/src/java/org/apache/fop/fo/properties/PropertyMaker.java b/src/java/org/apache/fop/fo/properties/PropertyMaker.java
index 5bed4bb1a..eed2a45df 100644
--- a/src/java/org/apache/fop/fo/properties/PropertyMaker.java
+++ b/src/java/org/apache/fop/fo/properties/PropertyMaker.java
@@ -21,7 +21,9 @@ package org.apache.fop.fo.properties;
import java.util.HashMap;
import java.util.Map;
-import org.apache.fop.apps.FOPException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.datatypes.CompoundDatatype;
import org.apache.fop.datatypes.LengthBase;
import org.apache.fop.datatypes.PercentBase;
@@ -29,12 +31,10 @@ import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FOPropertyMapping;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.expr.PropertyInfo;
import org.apache.fop.fo.expr.PropertyParser;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/**
* Base class for all property makers
@@ -55,7 +55,7 @@ public class PropertyMaker implements Cloneable {
protected Property defaultProperty;
protected CorrespondingPropertyMaker corresponding;
- private Log log = LogFactory.getLog(PropertyMaker.class);
+ private static Log log = LogFactory.getLog(PropertyMaker.class);
/**
* @return the name of the property for this Maker
@@ -235,7 +235,7 @@ public class PropertyMaker implements Cloneable {
*/
public Property findProperty(PropertyList propertyList,
boolean bTryInherit)
- throws FOPException
+ throws PropertyException
{
Property p = null;
@@ -279,16 +279,12 @@ public class PropertyMaker implements Cloneable {
*/
public Property get(int subpropId, PropertyList propertyList,
boolean bTryInherit, boolean bTryDefault)
- throws FOPException
+ throws PropertyException
{
Property p = findProperty(propertyList, bTryInherit);
if (p == null && bTryDefault) { // default value for this FO!
- try {
- p = make(propertyList);
- } catch (FOPException e) {
- // don't know what to do here
- }
+ p = make(propertyList);
}
return p;
}
@@ -363,9 +359,9 @@ public class PropertyMaker implements Cloneable {
* Return the default value.
* @param propertyList The PropertyList object being built for this FO.
* @return the Property object corresponding to the parameters
- * @throws FOPException for invalid or inconsisten FO input
+ * @throws PropertyException for invalid or inconsisten FO input
*/
- public Property make(PropertyList propertyList) throws FOPException {
+ public Property make(PropertyList propertyList) throws PropertyException {
if (defaultProperty != null) {
if (log.isTraceEnabled()) {
log.trace("PropertyMaker.make: reusing defaultProperty, "
@@ -391,10 +387,10 @@ public class PropertyMaker implements Cloneable {
* @param value The attribute value.
* @param fo The parent FO for the FO whose property is being made.
* @return The initialized Property object.
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException for invalid or inconsistent FO input
*/
public Property make(PropertyList propertyList, String value,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
try {
Property newProp = null;
String pvalue = value;
@@ -416,14 +412,13 @@ public class PropertyMaker implements Cloneable {
newProp = convertProperty(p, propertyList, fo);
}
if (newProp == null) {
- throw new org.apache.fop.fo.expr.PropertyException("No conversion defined");
+ throw new org.apache.fop.fo.expr.PropertyException("No conversion defined " + pvalue);
}
return newProp;
- } catch (org.apache.fop.fo.expr.PropertyException propEx) {
- String propName = FOPropertyMapping.getPropertyName(this.propId);
- throw new FOPException("Error in " + propName
- + " property value '" + value + "': "
- + propEx);
+ } catch (PropertyException propEx) {
+ propEx.setLocator(fo.locator);
+ propEx.setPropertyName(getName());
+ throw propEx;
}
}
@@ -439,50 +434,42 @@ public class PropertyMaker implements Cloneable {
* @param value the value of the
* @return baseProp (or if null, a new compound property object) with
* the new subproperty added
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException for invalid or inconsistent FO input
*/
public Property make(Property baseProp, int subpropId,
PropertyList propertyList, String value,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
//getLogger().error("compound property component "
// + partName + " unknown.");
return baseProp;
}
public Property convertShorthandProperty(PropertyList propertyList,
- Property prop, FObj fo) {
- Property pret = null;
- try {
- pret = convertProperty(prop, propertyList, fo);
- if (pret == null) {
- // If value is a name token, may be keyword or Enum
- String sval = prop.getNCname();
- if (sval != null) {
- // System.err.println("Convert shorthand ncname " + sval);
- pret = checkEnumValues(sval);
- if (pret == null) {
- /* Check for keyword shorthand values to be substituted. */
- String pvalue = checkValueKeywords(sval);
- if (!pvalue.equals(sval)) {
- // System.err.println("Convert shorthand keyword" + pvalue);
- // Substituted a value: must parse it
- Property p =
- PropertyParser.parse(pvalue,
- new PropertyInfo(this,
- propertyList,
- fo));
- pret = convertProperty(p, propertyList, fo);
- }
+ Property prop, FObj fo)
+ throws PropertyException
+ {
+ Property pret = convertProperty(prop, propertyList, fo);
+ if (pret == null) {
+ // If value is a name token, may be keyword or Enum
+ String sval = prop.getNCname();
+ if (sval != null) {
+ // System.err.println("Convert shorthand ncname " + sval);
+ pret = checkEnumValues(sval);
+ if (pret == null) {
+ /* Check for keyword shorthand values to be substituted. */
+ String pvalue = checkValueKeywords(sval);
+ if (!pvalue.equals(sval)) {
+ // System.err.println("Convert shorthand keyword" + pvalue);
+ // Substituted a value: must parse it
+ Property p =
+ PropertyParser.parse(pvalue,
+ new PropertyInfo(this,
+ propertyList,
+ fo));
+ pret = convertProperty(p, propertyList, fo);
}
}
}
- } catch (FOPException e) {
-
- //getLogger().error("convertShorthandProperty caught FOPException "
- // + e);
- } catch (org.apache.fop.fo.expr.PropertyException propEx) {
- //getLogger().error("convertShorthandProperty caught PropertyException "
- // + propEx);
}
if (pret != null) {
/*
@@ -538,11 +525,11 @@ public class PropertyMaker implements Cloneable {
* @param fo The parent FO for the FO whose property is being made.
* @return A Property of the correct type or null if the parsed value
* can't be converted to the correct type.
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException for invalid or inconsistent FO input
*/
protected Property convertProperty(Property p,
PropertyList propertyList,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
return null;
}
@@ -572,10 +559,10 @@ public class PropertyMaker implements Cloneable {
* @param propertyList The PropertyList for the FO.
* @return Property A computed Property value or null if no rules
* are specified to compute the value.
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException for invalid or inconsistent FO input
*/
protected Property compute(PropertyList propertyList)
- throws FOPException {
+ throws PropertyException {
if (corresponding != null) {
return corresponding.compute(propertyList);
}
@@ -595,7 +582,9 @@ public class PropertyMaker implements Cloneable {
* @param propertyList the collection of properties to be considered
* @return the Property, if found, the correspons, otherwise, null
*/
- public Property getShorthand(PropertyList propertyList) {
+ public Property getShorthand(PropertyList propertyList)
+ throws PropertyException
+ {
if (shorthands == null) {
return null;
}
@@ -615,6 +604,10 @@ public class PropertyMaker implements Cloneable {
}
return null;
}
+
+ public String getName() {
+ return FOPropertyMapping.getPropertyName(propId);
+ }
/**
* Return a clone of the makers. Used by useGeneric() to clone the
diff --git a/src/java/org/apache/fop/fo/properties/ShorthandParser.java b/src/java/org/apache/fop/fo/properties/ShorthandParser.java
index 0d6b7b09a..902bfcbe5 100644
--- a/src/java/org/apache/fop/fo/properties/ShorthandParser.java
+++ b/src/java/org/apache/fop/fo/properties/ShorthandParser.java
@@ -19,6 +19,7 @@
package org.apache.fop.fo.properties;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Interface used to provide parsing capabilities to Properties with shorthand
@@ -35,5 +36,5 @@ public interface ShorthandParser {
Property getValueForProperty(int propId,
Property property,
PropertyMaker maker,
- PropertyList propertyList);
+ PropertyList propertyList) throws PropertyException;
}
diff --git a/src/java/org/apache/fop/fo/properties/SpaceProperty.java b/src/java/org/apache/fop/fo/properties/SpaceProperty.java
index 5f062dbe4..d28f38c37 100644
--- a/src/java/org/apache/fop/fo/properties/SpaceProperty.java
+++ b/src/java/org/apache/fop/fo/properties/SpaceProperty.java
@@ -18,9 +18,9 @@
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Base class used for handling properties of the fo:space-before and
@@ -56,7 +56,7 @@ public class SpaceProperty extends LengthRangeProperty {
*/
public Property convertProperty(Property p,
PropertyList propertyList,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
if (p instanceof SpaceProperty) {
return p;
}
diff --git a/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java b/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java
index 0c92eaac2..53ddae093 100755
--- a/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java
+++ b/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java
@@ -18,10 +18,10 @@
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* A maker which creates 'letter-spacing' and 'word-spacing' properties.
@@ -43,7 +43,7 @@ public class SpacingPropertyMaker extends SpaceProperty.Maker {
*/
public Property convertProperty(Property p,
PropertyList propertyList,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
if (p.getEnum() == Constants.NORMAL) {
return p;
}
diff --git a/src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java
index a22490ace..d92f6ec2a 100644
--- a/src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java
@@ -19,11 +19,10 @@
package org.apache.fop.layoutmgr;
import java.util.ArrayList;
-import java.util.List;
import java.util.LinkedList;
+import java.util.List;
-import org.xml.sax.SAXParseException;
-
+import org.apache.fop.apps.FOPException;
import org.apache.fop.area.Area;
import org.apache.fop.fo.flow.Marker;
import org.apache.fop.fo.flow.RetrieveMarker;
@@ -112,7 +111,7 @@ public class RetrieveMarkerLayoutManager extends AbstractLayoutManager {
if (marker != null) {
try {
marker.rebind(fobj.getPropertyList());
- } catch (SAXParseException exc) {
+ } catch (FOPException exc) {
log.error("fo:retrieve-marker unable to rebind property values", exc);
}
marker.addLayoutManager(list);