-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
Hello π
Creating a RecurrenceRule with an interval that is just large enough causes IllegalArgumentException.
It looks like this happens here where the interval is multiple with 7 which causes it to overflow to a negative number which the calendar rightly rejects.
I do think lib-recur is doing the right thing rejecting this (it's a silly interval after all), but the exception is very unexpected.
Could/should this be validated a little earlier on and surfaced in a more obvious way perhaps?
Repro steps:
@Test
public void itOverflows() throws InvalidRecurrenceRuleException {
RecurrenceRule rule = new RecurrenceRule("FREQ=WEEKLY;INTERVAL=1000000000", RfcMode.RFC5545_STRICT);
RecurrenceRuleIterator iterator =
rule.iterator(1578406277000L, TimeZone.getTimeZone("America/New_York"));
}Exception:
java.lang.IllegalArgumentException: n must be >=0
at org.dmfs.rfc5545.calendarmetrics.NoLeapMonthCalendarMetrics.nextDay(NoLeapMonthCalendarMetrics.java:226)
at org.dmfs.rfc5545.recur.Freq$3.next(Freq.java:74)
at org.dmfs.rfc5545.recur.FreqIterator.next(FreqIterator.java:98)
at org.dmfs.rfc5545.recur.SanityFilter.next(SanityFilter.java:92)
at org.dmfs.rfc5545.recur.RecurrenceRuleIterator.fetchNextInstance(RecurrenceRuleIterator.java:95)
at org.dmfs.rfc5545.recur.RecurrenceRuleIterator.<init>(RecurrenceRuleIterator.java:89)
at org.dmfs.rfc5545.recur.RecurrenceRule.iterator(RecurrenceRule.java:2216)
at org.dmfs.rfc5545.recur.RecurrenceRule.iterator(RecurrenceRule.java:2140)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels