]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Better error-handling messages added for incorrect LayoutMasterSets.
authorGlen Mazza <gmazza@apache.org>
Tue, 8 Jun 2004 22:16:52 +0000 (22:16 +0000)
committerGlen Mazza <gmazza@apache.org>
Tue, 8 Jun 2004 22:16:52 +0000 (22:16 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197694 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
src/java/org/apache/fop/fo/pagination/PageSequence.java

index afa039b4a2c3b8f175ee9e870092830c5ac6e388..44d033b81d80db286ee6f80a50d08ecf9954f23c 100644 (file)
@@ -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 "
index 5bc84706f245c6fdb8cc4678670e9e3aecffb566..92a389aa2cbf6e8bef3918994aa3ba6ba0a46e50 100644 (file)
@@ -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();