Closed mpost closed 9 years ago
As http://joda-time.sourceforge.net/faq.html#illegalinstant tells, this is expected behaviour of Joda library. These are similar cases: http://stackoverflow.com/questions/25233776/unable-to-create-a-specific-joda-datetime-illegalinstantexception http://beust.com/weblog/2013/03/30/the-time-that-never-was/
Unfortunately, I couldn't reproduce this exception yet.
And here is an advice on how to handle (and to reproduce?!) the problem: http://stackoverflow.com/questions/5451152/how-to-handle-jodatime-illegal-instant-due-to-time-zone-offset-transition
Currently code crashes e.g. when Time zone in Android is set to "GMT+1:00 Central European Standard Time" (e.g. by selecting "Amsterdam" from a list):
org.joda.time.IllegalInstantException: ; startDate=2015-03-29T04:00:00.000+02:00 ( Europe/Amsterdam) caused by: org.joda.time.IllegalInstantException: Illegal instant due to time zone offset transition (daylight savings time 'gap'): 2015-03-29T02:00:00.000 (Europe/Amsterdam)
So it looks like the logic itself is wrong: we should change time not from 4AM to 2AM, but from 4AM (or any other time) to 0AM ?! ...Or, I got the logic: it assumes that Dates for All Day events are 0 hours at GMT ! The exception occurs, when there is no local time with 0 hours at this day.
The bug is fixed and corresponding code cleaned. See com.plusonelabs.calendar.calendar.CalendarEventProvider#fixAllDayEvent
The test now passes: com.plusonelabs.calendar.WidgetEntriesTest#testIllegalInstantDueToTimeZoneOffsetTransition
As reported in the Google Play Store. The issue has been existing in the 1.8.x release as well but continues to appear in 1.9.x.