Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Invalid Date Birthday crash #71

Merged
merged 5 commits into from
Oct 31, 2016
Merged

Invalid Date Birthday crash #71

merged 5 commits into from
Oct 31, 2016

Conversation

alexstyl
Copy link
Owner

@alexstyl alexstyl commented Oct 31, 2016

Description

This PR fixes the IllegalFieldValueException crash thrown when the user tries to create a Birthday on an invalid date. On the Birthday creation screen, when a new month or year is selected, we update the max day of month for the current month.

Crashlytics Log
Fatal Exception: org.joda.time.IllegalFieldValueException: Value 31 for dayOfMonth must be in the range [1,30]
       at org.joda.time.field.FieldUtils.verifyValueBounds(FieldUtils.java:252)
       at org.joda.time.chrono.BasicChronology.getDateMidnightMillis(BasicChronology.java:632)
       at org.joda.time.chrono.BasicChronology.getDateTimeMillis0(BasicChronology.java:186)
       at org.joda.time.chrono.BasicChronology.getDateTimeMillis(BasicChronology.java:160)
       at org.joda.time.chrono.AssembledChronology.getDateTimeMillis(AssembledChronology.java:120)
       at org.joda.time.LocalDate.(LocalDate.java:457)
       at org.joda.time.LocalDate.(LocalDate.java:436)
       at com.alexstyl.specialdates.date.Date.on(Date.java:41)
       at com.alexstyl.specialdates.addevent.ui.BirthdayDatePicker.getDisplayingBirthday(BirthdayDatePicker.java:131)
       at com.alexstyl.specialdates.addevent.BirthdayPickerDialog$1.onClick(BirthdayPickerDialog.java:93)
       at android.support.v7.app.AlertController$ButtonHandler.handleMessage(AlertController.java:157)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6077)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Tests added

Yes. The Date class now throws an IllegalArgumentException when some invalid date was asked to be created. Tests were added around this case.

@alexstyl alexstyl added the crash label Oct 31, 2016
@alexstyl alexstyl merged commit 9180732 into develop Oct 31, 2016
@alexstyl alexstyl deleted the wrong_date_crash branch October 31, 2016 22:49
alexstyl added a commit that referenced this pull request Jul 4, 2020
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.

1 participant