From cdab44e72103fb13f4400f54025b1f0af77cd0e6 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Wed, 12 Aug 2015 13:58:15 +0000 Subject: FOP-2510: Flow name infinite Loop git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1695517 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fo/pagination/PageSequence.java | 14 ++++++++++---- .../org/apache/fop/fo/pagination/PageSequenceMaster.java | 4 ++++ 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index d17abf623..6afd15e81 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -193,7 +193,7 @@ public class PageSequence extends AbstractPageSequence implements WritingModeTra * @throws org.apache.fop.fo.ValidationException if the fo:flow maps * to an invalid page-region */ - private void addFlow(Flow flow) throws ValidationException { + private void addFlow(Flow flow) throws ValidationException { String flowName = flow.getFlowName(); if (hasFlowName(flowName)) { @@ -201,14 +201,20 @@ public class PageSequence extends AbstractPageSequence implements WritingModeTra flowName, flow.getLocator()); } - if (!getRoot().getLayoutMasterSet().regionNameExists(flowName) - && !flowName.equals("xsl-before-float-separator") - && !flowName.equals("xsl-footnote-separator")) { + if (!hasRegion(flowName) && !flowName.equals("xsl-before-float-separator") + && !flowName.equals("xsl-footnote-separator")) { getFOValidationEventProducer().flowNameNotMapped(this, flow.getName(), flowName, flow.getLocator()); } } + private boolean hasRegion(String flowName) { + LayoutMasterSet set = getRoot().getLayoutMasterSet(); + PageSequenceMaster psm = set.getPageSequenceMaster(masterReference); + return (psm != null) ? psm.getLayoutMasterSet().regionNameExists(flowName) + : set.getSimplePageMaster(masterReference).regionNameExists(flowName); + } + /** * Get the static content FO node from the flow map. * This gets the static content flow for the given flow name. diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java index 6fa9b4261..86d5ff663 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java @@ -117,6 +117,10 @@ public class PageSequenceMaster extends FObj { subSequenceSpecifiers.add(pageMasterReference); } + public LayoutMasterSet getLayoutMasterSet() { + return layoutMasterSet; + } + /** * Returns the next subsequence specifier * @return a subsequence specifier -- cgit v1.2.3