From: Glen Mazza Date: Tue, 8 Jun 2004 22:16:52 +0000 (+0000) Subject: Better error-handling messages added for incorrect LayoutMasterSets. X-Git-Tag: Root_Temp_KnuthStylePageBreaking~724 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a0d68dd48a5241a2f6aa2a6ab5c91a08888d6962;p=xmlgraphics-fop.git Better error-handling messages added for incorrect LayoutMasterSets. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197694 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java index afa039b4a..44d033b81 100644 --- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java @@ -60,6 +60,10 @@ public class LayoutMasterSet extends FObj { if (parent.getName().equals("fo:root")) { Root root = (Root)parent; + if (root.getLayoutMasterSet() != null) { + throw new FOPException("Multiple fo:layout-master-sets " + + "found; only one allowed per document"); + } root.setLayoutMasterSet(this); } else { throw new FOPException("fo:layout-master-set must be child of fo:root, not " diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 5bc84706f..92a389aa2 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -138,12 +138,16 @@ public class PageSequence extends FObj { this.root = (Root)parent; // this.root.addPageSequence(this); } else { - throw new FOPException("page-sequence must be child of root, not " + throw new FOPException("Error: page-sequence must be child of root, not " + parent.getName()); } layoutMasterSet = root.getLayoutMasterSet(); - + + if (layoutMasterSet == null) { + throw new FOPException("Error: fo:layout-master-set undefined for this document"); + } + // best time to run some checks on LayoutMasterSet layoutMasterSet.checkRegionNames();