[FOray-commit] SF.net SVN: foray:[12458] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2022-01-22 22:37:34
|
Revision: 12458
http://sourceforge.net/p/foray/code/12458
Author: victormote
Date: 2022-01-22 22:37:31 +0000 (Sat, 22 Jan 2022)
Log Message:
-----------
Conform to aXSL change: Instead of throwing a checked exception when the sub-sequence-specifier children are exhaused, log an error and return null.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageMasterResolver4a.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection4a.java 2022-01-22 21:31:32 UTC (rev 12457)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection4a.java 2022-01-22 22:37:31 UTC (rev 12458)
@@ -35,7 +35,6 @@
import org.axsl.area.AreaTreeException;
import org.axsl.area.PageCollection;
import org.axsl.area.PageRa;
-import org.axsl.fotree.FoTreeException;
import org.axsl.fotree.fo.FolioPrefix;
import org.axsl.fotree.fo.FolioSuffix;
import org.axsl.fotree.fo.Marker;
@@ -201,11 +200,9 @@
isBlank = true;
}
}
- SimplePageMaster spm = null;
- try {
- spm = this.pageMasterResolver.getNextPageMaster(isBlank);
- } catch (final FoTreeException e) {
- throw new AreaTreeException(e);
+ final SimplePageMaster spm = this.pageMasterResolver.getNextPageMaster(isBlank);
+ if (spm == null) {
+ throw new AreaTreeException(this.pageMasterResolver.getClass() + " returned a null page master.");
}
final PageRa4a newPage = PageRa4a.makePageArea(spm, this);
this.children.add(newPage);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageMasterResolver4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageMasterResolver4a.java 2022-01-22 21:31:32 UTC (rev 12457)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/PageMasterResolver4a.java 2022-01-22 22:37:31 UTC (rev 12458)
@@ -28,7 +28,6 @@
package org.foray.fotree.fo.obj;
-import org.axsl.fotree.FoTreeException;
import org.axsl.fotree.fo.PageMasterResolver;
import org.axsl.fotree.fo.SimplePageMaster;
@@ -63,12 +62,10 @@
}
@Override
- public SimplePageMaster getNextPageMaster(final boolean isBlank)
- throws FoTreeException {
- final PageSequenceTemplate template = this.pageSequence
- .getPageSequenceTemplate();
- if (template instanceof org.foray.fotree.fo.obj.SimplePageMaster4a) {
- return (org.foray.fotree.fo.obj.SimplePageMaster4a) template;
+ public SimplePageMaster getNextPageMaster(final boolean isBlank) {
+ final PageSequenceTemplate template = this.pageSequence.getPageSequenceTemplate();
+ if (template instanceof SimplePageMaster4a) {
+ return (SimplePageMaster4a) template;
}
final PageSequenceMaster4a psm = (PageSequenceMaster4a) template;
if (psm == null) {
@@ -76,24 +73,20 @@
}
this.lastDocumentPageNumber ++;
final boolean lastPageOdd = (this.lastDocumentPageNumber % 2) == 1;
- final org.foray.fotree.fo.obj.SimplePageMaster4a spm =
- getNextSimplePageMaster(lastPageOdd, isBlank, psm);
+ final SimplePageMaster4a spm = getNextSimplePageMaster(lastPageOdd, isBlank, psm);
return spm;
}
/**
* Returns the next page master which should be used.
- * @param oddPage Indicates whether the new page should be an odd or even
- * page.
+ * @param oddPage Indicates whether the new page should be an odd or even page.
* @param blankPage Indicates whether the new page should be a blank page.
* @param psm The page-sequence-master which should be used.
* @return The next page master.
- * @throws FoTreeException If the page-sequence-master is exhausted and no
- * recovery is possible.
+ * @throws IllegalStateException If the page-sequence-master is exhausted and no recovery is possible.
*/
- private org.foray.fotree.fo.obj.SimplePageMaster4a getNextSimplePageMaster(
- final boolean oddPage, final boolean blankPage,
- final PageSequenceMaster4a psm) throws FoTreeException {
+ private SimplePageMaster4a getNextSimplePageMaster(final boolean oddPage,
+ final boolean blankPage, final PageSequenceMaster4a psm) {
boolean firstPage = false;
if (this.currentSubSequence == null) {
this.currentSubSequence = getNextSubSequence(psm);
@@ -110,15 +103,12 @@
psm);
firstPage = true;
if (nextSubSequence == null) {
- final String basicMessage = "Subsequences exhausted in "
- + "page-sequence-master \"" + psm.traitMasterName()
- + "\".";
- /* Log the warning in any case. */
- psm.getLogger().warn(basicMessage + "\n"
- + " Attempting to use previous subsequence.");
- if (!canRecover) {
- psm.throwException(basicMessage + "\n"
- + " Cannot recover.");
+ final String basicMessage = "Subsequences exhausted in fo:page-sequence-master \"" +
+ psm.traitMasterName() + "\".";
+ psm.getLogger().error(basicMessage + " Attempting to use previous subsequence.");
+ if (! canRecover) {
+ psm.getLogger().error(basicMessage + " Cannot recover.");
+ return null;
}
canRecover = false;
} else {
@@ -127,8 +117,7 @@
pageMasterName = this.currentSubSequence.getNextPageMasterName(
firstPage, false, oddPage, blankPage);
}
- final org.foray.fotree.fo.obj.SimplePageMaster4a pageMaster =
- psm.layoutMasterSet().getSimplePageMaster(pageMasterName);
+ final SimplePageMaster4a pageMaster = psm.layoutMasterSet().getSimplePageMaster(pageMasterName);
return pageMaster;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|