Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@carrizo
Copy link

@carrizo carrizo commented Dec 15, 2017

This solves bug #350

I did reproduce the error described by @Rx2TF which throws this exception:
java.lang.ArrayIndexOutOfBoundsException: length=5; index=-1

Looks like EventRecurrence#parse() method is leaving some garbage data in the EventRecurrence#byday field. This can be reproduced calling parse() two times, one with a weekly recurrence and then with a monthly recurrence; after this, the byday field keeps some data from the first call.

I didn't solve the root problem in EventRecurrence class because it looks like I can easily break something there.

dayNumber = 5;
}
details = mMonthRepeatByDayOfWeekStrs[weekday][dayNumber - 1];
if (dayNumber > 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just prevents the exception - we would have a "monthly > on the same day every month" return a "monthly > on the {n}th {weekday} of the month" string.

@potatopeelings
Copy link

potatopeelings commented Dec 16, 2017

@carrizo - I believe a cleaner way to fix this would be to make recurrence.byday be null

I made the following changes to fix this issue. Give it a shot and let me know if you run into any issues.

  1. byday = null; to resetFields in EventRecurrence.java
    This takes care of updates via a parse.
  2. eventRecurrence.byday = null; to the end of the first if block in case RecurrenceModel.FREQ_MONTHLY: in copyModelToEventRecurrence in RecurrencePickerDialogFragment.java
    This takes care of updates via the UI.

Cheers!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants