NullPointerException: Attempt to invoke virtual method 'void java.util.Calendar.setTimeZone(java.util.TimeZone)' on a null object reference



  • Hi,

    since I received Android 8.0 on my Huawei P10, the following error keeps occuring when synchronizing with my Nextcloud:

    --- BEGIN DEBUG INFO ---
    SYNCHRONIZATION INFO
    Synchronization phase: 4
    Account name: Nextcloud
    Authority: org.dmfs.tasks
    
    EXCEPTION:
    at.bitfire.ical4android.CalendarStorageException: Couldn't read locally stored event
    	at at.bitfire.ical4android.AndroidTask.getTask(AndroidTask.kt:68)
    	at at.bitfire.davdroid.resource.LocalTaskList.getDirty(LocalTaskList.kt:122)
    	at at.bitfire.davdroid.syncadapter.SyncManager.uploadDirty(SyncManager.kt:335)
    	at at.bitfire.davdroid.syncadapter.SyncManager.performSync(SyncManager.kt:136)
    	at at.bitfire.davdroid.syncadapter.TasksSyncAdapterService$TasksSyncAdapter.sync(TasksSyncAdapterService.kt:64)
    	at at.bitfire.davdroid.syncadapter.SyncAdapterService$SyncAdapter.onPerformSync(SyncAdapterService.kt:85)
    	at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:272)
    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.util.Calendar.setTimeZone(java.util.TimeZone)' on a null object reference
    	at java.text.DateFormat.setTimeZone(DateFormat.java:690)
    	at net.fortuna.ical4j.model.Iso8601.<init>(Iso8601.java:77)
    	at net.fortuna.ical4j.model.Date.<init>(Date.java:150)
    	at net.fortuna.ical4j.model.DateTime.<init>(DateTime.java:253)
    	at at.bitfire.ical4android.AndroidTask.populateTask(AndroidTask.kt:131)
    	at at.bitfire.davdroid.resource.LocalTask.populateTask(LocalTask.kt:47)
    	at at.bitfire.ical4android.AndroidTask.getTask(AndroidTask.kt:63)
    	... 6 more
    
    SOFTWARE INFORMATION
    Package: at.bitfire.davdroid
    Version: 1.10.1.1-gplay (206) from 20.01.2018
    Installed from: com.android.vending
    JB Workaround installed: no
    
    CONNECTIVITY (at the moment)
    Active connection: WiFi, CONNECTED
    
    CONFIGURATION
    Power saving disabled: yes
    android.permission.READ_CONTACTS permission: granted
    android.permission.WRITE_CONTACTS permission: granted
    android.permission.READ_CALENDAR permission: granted
    android.permission.WRITE_CALENDAR permission: granted
    org.dmfs.permission.READ_TASKS permission: granted
    org.dmfs.permission.WRITE_TASKS permission: granted
    System-wide synchronization: automatically
    Account: Nextcloud
      Address book sync. interval: 1440 min
      Calendar     sync. interval: 60 min
      OpenTasks    sync. interval: 60 min
      WiFi only: false
      [CardDAV] Contact group method: GROUP_VCARDS
      [CalDAV] Time range (past days): 90
               Manage calendar colors: true
    Address book account: Kontakte (Nextcloud dA)
      Main account: Account {name= XXXXXXXXX, type=bitfire.at.davdroid}
      URL: https://xxxxxx.no-ip.org/remote.php/carddav/addressbooks/xxxxxx/Kontakte/
      Sync automatically: true
    
    SQLITE DUMP
    android_metadata
    	|  locale |
    	|  de_DE |
    ----------
    services
    	|  _id | accountName | service | principal |
    	|  1 | Nextcloud | carddav | https://xxxxxx.no-ip.org/remote.php/carddav/principals/xxxxxx/ |
    	|  2 | Nextcloud | caldav | https://xxxxxx.no-ip.org/remote.php/caldav/principals/xxxxxx/ |
    ----------
    sqlite_sequence
    	|  name | seq |
    	|  services | 4 |
    	|  homesets | 11 |
    	|  collections | 57 |
    ----------
    homesets
    	|  _id | serviceID | url |
    	|  2 | 1 | https://xxxxxx.no-ip.org/remote.php/carddav/addressbooks/xxxxxx/ |
    	|  11 | 2 | https://xxxxxx.no-ip.org/remote.php/caldav/calendars/xxxxxx/ |
    ----------
    collections
    	|  _id | serviceID | type | url | readOnly | forceReadOnly | displayName | description | color | timezone | supportsVEVENT | supportsVTODO | source | sync |
    	|  5 | 1 | ADDRESS_BOOK | https://xxxxxx.no-ip.org/remote.php/carddav/addressbooks/xxxxxx/Kontakte/ | 0 | 0 | Kontakte | <null> | <null> | <null> | 0 | 0 | <null> | 1 |
    	|  52 | 2 | CALENDAR | https://xxxxxx.no-ip.org/remote.php/caldav/calendars/xxxxxx/contact_birthdays/ | 1 | 0 | Geburtstage von Kontakten | <null> | -54 | <null> | 1 | 0 | <null> | 1 |
    	|  53 | 2 | CALENDAR | https://xxxxxx.no-ip.org/remote.php/caldav/calendars/xxxxxx/familie/ | 0 | 0 | Familie | <null> | -9115730 | <null> | 1 | 1 | <null> | 1 |
    	|  54 | 2 | CALENDAR | https://xxxxxx.no-ip.org/remote.php/caldav/calendars/xxxxxx/pers%c3%b6nlich/ | 0 | 0 | Persönlich | Persönlich | -16777216 | <null> | 1 | 1 | <null> | 1 |
    	|  55 | 2 | CALENDAR | https://xxxxxx.no-ip.org/remote.php/caldav/calendars/xxxxxx/xxxx/ | 0 | 0 | TakeASP | <null> | -39936 | <null> | 1 | 1 | <null> | 1 |
    	|  56 | 2 | CALENDAR | https://xxxxxx.no-ip.org/remote.php/caldav/calendars/xxxxxx/xxxxxxxxxxx/ | 0 | 0 | Team Orange | <null> | -26112 | <null> | 1 | 1 | <null> | 1 |
    	|  57 | 2 | CALENDAR | https://xxxxxx.no-ip.org/remote.php/caldav/calendars/xxxxxx/xxx/ | 0 | 0 | Vogel Business Media | Vogel Business Media | -16687987 | <null> | 1 | 1 | <null> | 1 |
    ----------
    
    SYSTEM INFORMATION
    Android version: 8.0.0 (VTR-L09 8.0.0.360(C432))
    Device: HUAWEI VTR-L09 (HWVTR)
    
    --- END DEBUG INFO ---
    

    This issue doesn't occur on the same device when I use CalDAV-Sync e.g.

    Best regards
    Thomas


  • developer

    Is this error reproducible? Can you provide steps to reproduce (including your system time zone and task details)? I'd need to reproduce the problem so that I can have a look at that.


  • developer

    Hello,

    Did you already find out which task was related?


  • developer

    For the records: We have received several reports with this exception. However, I was still unable to reproduce this issue and thus have no idea where it might come from…

    If you have any useful hints, please let us know.

    ical4j report: https://github.com/ical4j/ical4j/issues/229



  • It happens to me as well, every time it syncs this errors appears as notification.

    I have Android 8.0.


  • developer

    @dolohow Unfortunately, we still don't have an idea what the problem could be or how it could be reproduced. Any hints are appreciated…



  • Hi,

    now i update DavDroid v1.11.1-gplay - and this issue disappear. ☺

    Below you can find the error log, from the previous version.

    • Nextloud Server v13.0.1
    • DavDroid v1.11-gplay (213)
    • Phone: Samsung S9 - v8.0.0

    0_1524856632420_debug.txt


  • developer

    Maybe 1.11.1 fixes this problem for the others too? We haven't changed anything about event/calendar handling in .1, but if it's fixed – even better 😉



  • I still have the issue, with davdroid 1.11.1 galaxy S8 android version 8.0.0

    Issue 229 on github also mentions another linked issue which is still open but mentions hcalendar:- https://github.com/ical4j/ical4j/issues/219

    Mine failed on this Ical entry if useful:-

    BEGIN:VCALENDAR
    VERSION:2.0
    PRODID:-//ddaysoftware.com//NONSGML DDay.iCal 1.0//EN
    BEGIN:VTIMEZONE
    TZID:GMT Standard Time
    BEGIN:STANDARD
    DTSTART:19701025T020000
    RRULE:FREQ=YEARLY;BYDAY=-1SU;BYHOUR=2;BYMINUTE=0;BYMONTH=10
    TZNAME:GMT Standard Time
    TZOFFSETFROM:+0100
    TZOFFSETTO:+0000
    END:STANDARD
    BEGIN:DAYLIGHT
    DTSTART:19700329T010000
    RRULE:FREQ=YEARLY;BYDAY=-1SU;BYHOUR=1;BYMINUTE=0;BYMONTH=3
    TZNAME:GMT Summer Time
    TZOFFSETFROM:+0000
    TZOFFSETTO:+0100
    END:DAYLIGHT
    END:VTIMEZONE
    BEGIN:VEVENT
    ATTENDEE;PARTSTAT=NEEDS-ACTION;CN=bob@example.com;ROLE=REQ-PARTICIPANT;RS
     VP=TRUE;SCHEDULE-AGENT=CLIENT:mailto:bob@example.com
    CLASS:PUBLIC
    DESCRIPTION:Call To +445556487078\nNumber: +445556487078\nDuration: 0 secon
     ds
    DTEND;TZID=GMT Standard Time:20180418T102600
    DTSTAMP:20180505T145147Z
    DTSTART;TZID=GMT Standard Time:20180418T102600
    ORGANIZER;CN=bob@example.com;SCHEDULE-AGENT=CLIENT;SCHEDULE-STATUS=1.1:ma
     ilto:bob@example.com
    PRIORITY:5
    SEQUENCE:0
    SUMMARY:Call To +445556487078
    TRANSP:OPAQUE
    UID:00f49511-ae3e-4d70-bc71-925514936f2f
    X-MICROSOFT-CDO-BUSYSTATUS:BUSY
    END:VEVENT
    END:VCALENDAR
    

    it was working fine syncing with cpanel (horde) as the server and now I have just switched to self hosted davical 1.1.4 the problem has arisen.



  • OK I fixed my issue by adding a line to the davical config to handle the nonstandard timezone as follows:-

    $c->timezone_translations = array( 'GMT Standard Time' => 'Europe/London' );


  • developer

    Thanks. Couldn't reproduce this on 8.0 in the emulator… I guess it must be related to time zone name, maybe because of the space? And it seems to occur in very specific images of 8.0.0 only… and it's an Android bug, because java.text.DateFormat.setTimeZone(DateFormat.java:690) throws the exception, and that's part of the Android Java library (and not in userspace, i.e. ical4android/DAVdroid)…



  • I am also having this problem. I just noticed it now, while debugging the fact that new calendar entries were not being synced from the phone to the server. I tried disabling the calendar from the sync settings (which removed all entries from the phone calendar, as expected), and then reenabling the calendar. I now have the same exception above, in one ICS entry. Syncing does not work, I am assuming the exception kills the sync process.

    I am attaching the ICS that causes the problem, as retrieved from the ownCloud server following the URL specified in the DAVDroid debug output. For some reason, the dates are all wrong, shifted by multiple decades. There must have been some corruption somewhere along the way, possibly at an earlier time. I hope it did not affect many entries.

    0_1526246315493_09628aaa-ee02-402e-9971-be7ecee977d5.ics



  • @rfc2822 said in NullPointerException: Attempt to invoke virtual method 'void java.util.Calendar.setTimeZone(java.util.TimeZone)' on a null object reference:

    Maybe 1.11.1 fixes this problem for the others too? We haven't changed anything about event/calendar handling in .1, but if it's fixed – even better 😉

    No, I have updated to 1.11.3-gplay and the issue is still there. What's even worse, I don't receive a notification about the problem, it just silently stopped syncing.

    I'm using Android 8.0.0 and radicale