@Override StubConvention toImplicit(PeriodicSchedule definition, boolean explicitInitialStub, boolean explicitFinalStub) { if ((explicitInitialStub && explicitFinalStub) == false) { throw new ScheduleException( definition, "Stub convention is 'Both' but explicit dates not specified"); } return NONE; } };
public void test_withoutDefinition() { ScheduleException test = new ScheduleException("Hello {}", "World"); assertEquals(test.getMessage(), "Hello World"); assertEquals(test.getDefinition(), Optional.empty()); }
createAdjustedDates(refData); ScheduleException se = new ScheduleException(this, "Schedule calculation resulted in invalid period"); se.initCause(ex); throw se;
public void test_withDefinition() { PeriodicSchedule defn = PeriodicSchedule.of( date(2014, 6, 30), date(2014, 8, 30), Frequency.P1M, BusinessDayAdjustment.NONE, StubConvention.NONE, false); ScheduleException test = new ScheduleException(defn, "Hello {}", "World"); assertEquals(test.getMessage(), "Hello World"); assertEquals(test.getDefinition(), Optional.of(defn)); }
@Override StubConvention toImplicit(PeriodicSchedule definition, boolean explicitInitialStub, boolean explicitFinalStub) { if (explicitInitialStub) { throw new ScheduleException( definition, "Dates specify an explicit initial stub, but stub convention is 'ShortFinal'"); } return (explicitFinalStub ? NONE : SHORT_FINAL); } },
@Override StubConvention toImplicit(PeriodicSchedule definition, boolean explicitInitialStub, boolean explicitFinalStub) { if (explicitInitialStub) { throw new ScheduleException( definition, "Dates specify an explicit initial stub, but stub convention is 'SmartFinal'"); } return (explicitFinalStub ? NONE : SMART_FINAL); }
@Override StubConvention toImplicit(PeriodicSchedule definition, boolean explicitInitialStub, boolean explicitFinalStub) { if (explicitFinalStub) { throw new ScheduleException( definition, "Dates specify an explicit final stub, but stub convention is 'ShortInitial'"); } return (explicitInitialStub ? NONE : SHORT_INITIAL); } },
@Override StubConvention toImplicit(PeriodicSchedule definition, boolean explicitInitialStub, boolean explicitFinalStub) { if (explicitInitialStub) { throw new ScheduleException( definition, "Dates specify an explicit initial stub, but stub convention is 'LongFinal'"); } return (explicitFinalStub ? NONE : LONG_FINAL); }
@Override StubConvention toImplicit(PeriodicSchedule definition, boolean explicitInitialStub, boolean explicitFinalStub) { if (explicitInitialStub || explicitFinalStub) { throw new ScheduleException( definition, "Dates specify an explicit stub, but stub convention is 'None'"); } return NONE; } },
@Override StubConvention toImplicit(PeriodicSchedule definition, boolean explicitInitialStub, boolean explicitFinalStub) { if (explicitFinalStub) { throw new ScheduleException( definition, "Dates specify an explicit final stub, but stub convention is 'LongInitial'"); } return (explicitInitialStub ? NONE : LONG_INITIAL); }
@Override StubConvention toImplicit(PeriodicSchedule definition, boolean explicitInitialStub, boolean explicitFinalStub) { if (explicitFinalStub) { throw new ScheduleException( definition, "Dates specify an explicit final stub, but stub convention is 'SmartInitial'"); } return (explicitInitialStub ? NONE : SMART_INITIAL); }
throw new ScheduleException( schedule, "Date '{}' does not match roll convention '{}' when starting to roll forwards", start, rollConv); if (stub && dates.size() > 1) { if (stubConv == StubConvention.NONE) { throw new ScheduleException( schedule, "Period '{}' to '{}' resulted in a disallowed stub with frequency '{}'", start, end, frequency);
throw new ScheduleException(this, "Schedule calculation resulted in duplicate unadjusted dates {}", unadj);
throw new ScheduleException(this, "Schedule calculation resulted in duplicate unadjusted dates {}", unadj);
throw new ScheduleException( this, "Schedule calculation resulted in duplicate adjusted dates {} from unadjusted dates {} using adjustment '{}'",
throw new ScheduleException(this, "Explicit stubs must not be specified when using 'Term' frequency");
throw new ScheduleException( "Unable to merge schedule, firstRegularStartDate {} does not match any date in the underlying schedule {}", firstRegularStartDate, throw new ScheduleException( "Unable to merge schedule, lastRegularEndDate {} does not match any date in the underlying schedule {}", lastRegularEndDate, if ((numberRegular % groupSize) != 0) { Period newFrequency = frequency.getPeriod().multipliedBy(groupSize); throw new ScheduleException( "Unable to merge schedule, firstRegularStartDate {} and lastRegularEndDate {} cannot be used to " + "create regular periods of frequency '{}'",
!firstRegularStartDate.equals(accrualSchedule.getUnadjustedStartDate()) && !firstRegularStartDate.equals(accrualSchedule.getStartDate())) { throw new ScheduleException("Unable to create schedule for frequency 'Term' when firstRegularStartDate != startDate"); throw new ScheduleException("Unable to create schedule for frequency 'Term' when lastRegularEndDate != endDate");
private static List<LocalDate> generateBackwards( PeriodicSchedule schedule, LocalDate start, LocalDate end, Frequency frequency, RollConvention rollConv, StubConvention stubConv, LocalDate explicitStartDate) { // validate if (rollConv.matches(end) == false) { throw new ScheduleException( schedule, "Date '{}' does not match roll convention '{}' when starting to roll backwards", end, rollConv); } // generate BackwardsList dates = new BackwardsList(estimateNumberPeriods(start, end, frequency)); dates.addFirst(end); LocalDate temp = rollConv.previous(end, frequency); while (temp.isAfter(start)) { dates.addFirst(temp); temp = rollConv.previous(temp, frequency); } // convert to long stub, but only if we actually have a stub boolean stub = temp.equals(start) == false; if (stub && dates.size() > 1 && stubConv.isStubLong(start, dates.get(0))) { dates.removeFirst(); } dates.addFirst(explicitStartDate); return dates; }