wsharba / opendatakit

Automatically exported from code.google.com/p/opendatakit
0 stars 1 forks source link

Date May 01 1990 crashed ODK #1048

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open the attached XLSForm in ODK
2. Enter the date May 01 1990
3. Go the next page

What is the expected output? What do you see instead?
It should be able to move to the next page. Instead, ODK crashes.

What version of the product are you using? On what operating system?
I am using ODK Collect 1.4.3 (1042) on full stock ASUS Google Nexus 4 running 
Android 4.4.4, build number KTU84P. The language/locale is English (United 
States).

Please provide any additional information below.
Yaw Anokwa tested this on Nexus 4, and he faced no issues.

Original issue reported on code.google.com by sydney....@gmail.com on 18 Aug 2014 at 6:03

Attachments:

GoogleCodeExporter commented 9 years ago
I am using ASUS Google Nexus 7 NOT 4. I apologize for the mistake.

Original comment by sydney....@gmail.com on 18 Aug 2014 at 6:05

GoogleCodeExporter commented 9 years ago
Thank you for the logs. They indicated time zone treatments were the problem...

E/AndroidRuntime( 1768): java.lang.IllegalArgumentException: Illegal instant 
due to time zone offset transition: 1990-04-30T22:00:00.000
E/AndroidRuntime( 1768):    at 
org.joda.time.chrono.ZonedChronology.localToUTC(ZonedChronology.java:143)
E/AndroidRuntime( 1768):    at 
org.joda.time.chrono.ZonedChronology.getDateTimeMillis(ZonedChronology.java:119)
E/AndroidRuntime( 1768):    at 
org.joda.time.chrono.AssembledChronology.getDateTimeMillis(AssembledChronology.j
ava:133)
E/AndroidRuntime( 1768):    at 
org.joda.time.base.BaseDateTime.<init>(BaseDateTime.java:254)
E/AndroidRuntime( 1768):    at 
org.joda.time.base.BaseDateTime.<init>(BaseDateTime.java:195)
E/AndroidRuntime( 1768):    at org.joda.time.DateTime.<init>(DateTime.java:307)
E/AndroidRuntime( 1768):    at 
org.odk.collect.android.widgets.DateWidget.getAnswer(DateWidget.java:230)

In the code, this is when we construct a DateTime object with 0 hours, 0 
minutes (for the zero hour, zero minute on that date):

        DateTime ldt =
            new DateTime(mDatePicker.getYear(), (!showCalendar && hideMonth) ? 1 : mDatePicker.getMonth() + 1,
                    (!showCalendar && (hideMonth || hideDay)) ? 1 : mDatePicker.getDayOfMonth(), 0, 0);

Unfortunately, in whatever timezone this is, there is a daylight savings time 
correction that makes this precise time invalid.

It does not appear that there is any clear generic correct coding for this. 

http://stackoverflow.com/questions/5451152/how-to-handle-jodatime-illegal-instan
t-due-to-time-zone-offset-transition

Keeping this issue open, as I don't see a generic way to address the issue.

Original comment by mitchellsundt@gmail.com on 17 Nov 2014 at 7:19