boolean isBlankPage)
throws FOPException {
if (currentSubSequence == null) {
currentSubSequence = getNextSubSequence();
if (currentSubSequence == null) {
throw new FOPException("no subsequences in page-sequence-master '"
+ masterName + "'");
}
}
String pageMasterName = currentSubSequence
.getNextPageMasterName(isOddPage, isFirstPage, isLastPage, isBlankPage);
boolean canRecover = true;
while (pageMasterName == null) {
SubSequenceSpecifier nextSubSequence = getNextSubSequence();
if (nextSubSequence == null) {
if (!canRecover) {
throw new FOPException("subsequences exhausted in page-sequence-master '"
+ masterName
+ "', cannot recover");
}
log.warn("subsequences exhausted in page-sequence-master '"
+ masterName
+ "', using previous subsequence");
currentSubSequence.reset();
canRecover = false;
} else {
currentSubSequence = nextSubSequence;
}
pageMasterName = currentSubSequence
.getNextPageMasterName(isOddPage, isFirstPage, isLastPage, isBlankPage);
}
SimplePageMaster pageMaster = this.layoutMasterSet
.getSimplePageMaster(pageMasterName);
if (pageMaster == null) {
throw new FOPException("No simple-page-master matching '"
+ pageMasterName + "' in page-sequence-master '"
+ masterName + "'");
}
return pageMaster;
}