dmfs/lib-recur

RecurrenceRule.setByDayPart doesn't remove BYDAY part when given an empty list

Closed this issue · 1 comments

Calling RecurrenceRule#setByDayPart with an empty list seems to include that empty list in the parts map — I believe it's due to a missing else or return in the method:

public void setByDayPart(List<WeekdayNum> value)
{
if (value == null || value.size() == 0)
{
mParts.remove(Part.BYDAY);
}
mParts.put(Part.BYDAY, value);
}

This makes the resulting rule have an empty BYDAY-value, e.g. "FREQ=MONTHLY;BYMONTHDAY=31;BYDAY=", eventually leading to an "too many empty recurrence sets" exception when expanding the rule.

dmfs commented

Admittedly, the setters never were a real use case for me so far, that's probably why they are so poorly tested. Thanks for reporting and fixing this. I hope there are no other bad surprises there.