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


  • 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


  • developer

    We received the information from @belidzs that the latest Android update fixed the problem.

    I guess this is an Android firmware problem and encourage everyone with this problem to update to the latest firmware version as soon as possible.

    Does upgrading Android fix this problem for other affected users here, too?



  • Hello,

    I was getting the same error message until I have checked the Contact birthdays calendar to sync in CalDAV as it was intentionally not set to sync from the very beginning.

    Right now, I am not getting that error message again, even despite that I have force closed DAVDroid and reopened it.

    Now I cannot even see my calendars anymore 😕

    I am attaching two debug logs and a screenshot.

    According to the debug log, the only difference is the sync row 0 vs 1.

    0_1527447154969_davdroid-error-message.jpg

    Update

    Hum, that is interesting… A basic reinstallation of DAVdroid 1.11.3-gplay was not helping, but when I have installed 1.9.9-gplay, the sync worked as expected. Then I’ve installed 1.11.2-gplay and it worked too. Then I have installed 1.11.3-gplay back, and so it has also worked.

    I am confused now 🙂 The good point that it is working now for me. (without me cleaning the brute force attempts table, see below)

    If you anyone is having the same issue while using Nextcloud or Owncloud, please try cleaning your brute force attempts table from it:

    1. stop your nextcloud/owncloud instance;
    2. backup your nextcloud/owncloud database;
    3. delete records from the brute force attempts table:
    
    $ sqlite3 /path/to/nextcloud/data/owncloud.db
    sqlite> BEGIN;
    sqlite> SELECT * FROM oc_bruteforce_attempts;
    sqlite> DELETE FROM oc_bruteforce_attempts;
    sqlite> SELECT * FROM oc_bruteforce_attempts;
    sqlite> COMMIT;
    sqlite> .quit
    
    4. start your Nextcloud/Owncloud back again and try DAVdroid to sync the Calendar again.
    

    Kind regards,
    Andrey Arapov


  • developer

    @arno Thanks for the update. Were there any Android/system updates in this time?



  • @rfc2822 AFAIR, there was Android OS update quiet some time ago, longer before I started to see the error message. The first time I’ve got the error message was the last week as I was traveling to Greece, so the timezone was shifted by +1 hour. That was the time I started to see the error message. Also, it might be worth mentioning, I was making a phone factory reset just a day before I traveled to Greece last week.



  • I had the same exception all of a sudden this afternoon. I updated DAVdroid to 1.11.4-beta4-ose (from F-Droid) yesterday evening, syncing flawlessly during the entire morning. Disabling and enabling claendars in DAVdroid didn’t make any difference. I also deleted the calendar storage data from the Android settings > apps, same error occurred.

    Hum, that is interesting… A basic reinstallation of DAVdroid 1.11.3-gplay was not helping, but when I have installed 1.9.9-gplay, the sync worked as expected. Then I’ve installed 1.11.2-gplay and it worked too. Then I have installed 1.11.3-gplay back, and so it has also worked.

    That’s basically what seems to have helped also for me: I uninstalled DAVdroid 1.11.1-ose (the oldest version F-Droid is offering) and synced my calendars. Then I updated to 1.11.2-ose and synced, no problem occurred. Finally I updated to 1.11.4-beta4-ose and up until now sync works like a charm.

    I hope this help aniling the culprit down.



  • I’m also experiencing this bug for the last few days. No major update of Android for the last few weeks.
    I noticed this bug was triggered when I created/updated an event on my calendar (stored on a private Owncloud).
    Is there a way to detect which event could have triggered the bug?



  • @dco The issue resolved by itself. No Android update, no Owncloud update, just moved some calendar entries further in time 😕



  • I have the same problem.
    1 SOGO server with a shared calander.

    When i make a event in de shared calander with time then i get the error.

    --- BEGIN DEBUG INFO ---
    Account name: nike @ anjo sogo
    Authority: org.dmfs.tasks
    
    LOCAL RESOURCE:
    LocalTask=[eTag=null, fileName=76d23e9f-ca05-4956-9c42-51f12599365f.ics, flags=0, id=1, task=Task=[classification=null, color=null, completedAt=null, createdAt=1531077792643, description=null, dtStart=null, due=null, duration=null, exDates=[], geoPosition=null, lastModified=1531077792643, location=null, organizer=null, percentComplete=null, priority=0, rDates=[], rRule=null, status=STATUS:NEEDS-ACTION, summary=Test3, url=null, sequence=0, uid=76d23e9f-ca05-4956-9c42-51f12599365f, shadow$_klass_=class at.bitfire.ical4android.Task, shadow$_monitor_=0], taskList=at.bitfire.davdroid.resource.LocalTaskList@4cdb1c8, shadow$_klass_=class at.bitfire.davdroid.resource.LocalTask, shadow$_monitor_=0]
    
    REMOTE RESOURCE:
    https://XXX/SOGo/dav/nike@XXX/Calendar/23F-5B22AA80-1-17769D80/76d23e9f-ca05-4956-9c42-51f12599365f.ics
    
    EXCEPTION:
    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.Iso8601.<init>(Iso8601.java:94)
    	at net.fortuna.ical4j.model.Date.<init>(Date.java:130)
    	at net.fortuna.ical4j.model.DateTime.<init>(DateTime.java:235)
    	at net.fortuna.ical4j.model.DateTime.<init>(DateTime.java:244)
    	at net.fortuna.ical4j.model.property.UtcProperty.<init>(UtcProperty.java:67)
    	at net.fortuna.ical4j.model.property.DtStamp.<init>(DtStamp.java:94)
    	at net.fortuna.ical4j.model.component.VToDo.<init>(VToDo.java:149)
    	at net.fortuna.ical4j.model.component.VToDo.<init>(VToDo.java:143)
    	at at.bitfire.ical4android.Task.write(Task.kt:133)
    	at at.bitfire.davdroid.syncadapter.TasksSyncManager$prepareUpload$1.invoke(TasksSyncManager.kt:83)
    	at at.bitfire.davdroid.syncadapter.TasksSyncManager$prepareUpload$1.invoke(TasksSyncManager.kt:42)
    	at at.bitfire.davdroid.syncadapter.BaseDavSyncManager.useLocal(BaseDavSyncManager.kt:296)
    	at at.bitfire.davdroid.syncadapter.TasksSyncManager.prepareUpload(TasksSyncManager.kt:78)
    	at at.bitfire.davdroid.syncadapter.TasksSyncManager.prepareUpload(TasksSyncManager.kt:42)
    	at at.bitfire.davdroid.syncadapter.BaseDavSyncManager$uploadDirty$1$1.invoke(BaseDavSyncManager.kt:142)
    	at at.bitfire.davdroid.syncadapter.BaseDavSyncManager$uploadDirty$1$1.invoke(BaseDavSyncManager.kt:37)
    	at at.bitfire.davdroid.syncadapter.BaseDavSyncManager.useRemote(BaseDavSyncManager.kt:303)
    	at at.bitfire.davdroid.syncadapter.BaseDavSyncManager$uploadDirty$1.invoke(BaseDavSyncManager.kt:140)
    	at at.bitfire.davdroid.syncadapter.BaseDavSyncManager$uploadDirty$1.invoke(BaseDavSyncManager.kt:37)
    	at at.bitfire.davdroid.syncadapter.BaseDavSyncManager.useLocal(BaseDavSyncManager.kt:296)
    	at at.bitfire.davdroid.syncadapter.BaseDavSyncManager.uploadDirty(BaseDavSyncManager.kt:131)
    	at at.bitfire.davdroid.syncadapter.SyncManager.performSync(SyncManager.kt:109)
    	at at.bitfire.davdroid.syncadapter.TasksSyncAdapterService$TasksSyncAdapter.sync(TasksSyncAdapterService.kt:64)
    	at at.bitfire.davdroid.syncadapter.SyncAdapterService$SyncAdapter.onPerformSync(SyncAdapterService.kt:97)
    	at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:272)
    
    SOFTWARE INFORMATION
    Package: at.bitfire.davdroid
    Version: 1.11.5-gplay (233) from 17 jun. 2018
    Installed from: com.android.vending
    JB Workaround installed: no
    
    CONNECTIVITY (at the moment)
    Active connection: WiFi, CONNECTED
    
    CONFIGURATION
    Power saving disabled: no
    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: nike @ anjo sogo
      Address book sync. interval: 240 min
      Calendar     sync. interval: 15 min
      OpenTasks    sync. interval: 240 min
      WiFi only: false
      [CardDAV] Contact group method: GROUP_VCARDS
      [CalDAV] Time range (past days): 90
               Manage calendar colors: false
    
    SQLITE DUMP
    android_metadata
    	|  locale |
    	|  nl_NL |
    ----------
    services
    	|  _id | accountName | service | principal |
    	|  2 | nike @ anjo sogo | carddav | https://XXX.com/SOGo/dav/nike@XXX/ |
    	|  3 | nike @ anjo sogo | caldav | https://XXXl.com/SOGo/dav/nike@XXX/ |
    ----------
    sqlite_sequence
    	|  name | seq |
    	|  services | 3 |
    	|  homesets | 4 |
    	|  collections | 10 |
    ----------
    homesets
    	|  _id | serviceID | url |
    	|  3 | 2 | https://XXX.com/SOGo/dav/nike@XXX/Contacts/ |
    	|  4 | 3 | https://XXX.com/SOGo/dav/nike@XXX.com/Calendar/ |
    ----------
    collections
    	|  _id | serviceID | type | url | readOnly | forceReadOnly | displayName | description | color | timezone | supportsVEVENT | supportsVTODO | source | sync |
    	|  7 | 2 | ADDRESS_BOOK | https://XXX.com/SOGo/dav/nike@XXX.com/Contacts/personal/ | 0 | 0 | Persoonlijk adresboek | <null> | <null> | <null> | 0 | 0 | <null> | 0 |
    	|  8 | 2 | ADDRESS_BOOK | https://XXX.com/SOGo/dav/nike@XXX.com/Contacts/users/ | 0 | 0 | Domain Address Book | <null> | <null> | <null> | 0 | 0 | <null> | 0 |
    	|  9 | 3 | CALENDAR | https://XXX.com/SOGo/dav/nike@XXX.com/Calendar/personal/ | 0 | 0 | Persoonlijke agenda | <null> | -5592406 | <null> | 1 | 1 | <null> | 0 |
    	|  10 | 3 | CALENDAR | https://XXX.com/SOGo/dav/nike@XXX.com/Calendar/23F-5B22AA80-1-17769D80/ | 0 | 0 | Rene & Anjo | <null> | -5592406 | <null> | 1 | 1 | <null> | 1 |
    ----------
    
    SYSTEM INFORMATION
    Android version: 8.0.0 (R16NW.G930FXXU2EREM)
    Device: samsung SM-G930F (herolte)
    
    --- END DEBUG INFO ---
    

    I removed my domain.
    I have a samsung galaxy S7 with android 8.0.0



  • I have similar issue on my Huawei P10.
    Android 8.0
    DAVdroid 1.11.5
    Fastmail

    I removed LOCATION and SUMMARY fields:

    [GetContentType(type=text/calendar; charset=utf-8; component=VEVENT), 940227c704a5f09014ae7673e6a401cc62d15679, CalendarData(iCalendar=BEGIN:VCALENDAR
    VERSION:2.0
    CALSCALE:GREGORIAN
    PRODID:-//FastMail/1.0/EN
    BEGIN:VTIMEZONE
    TZID:Europe/Warsaw
    BEGIN:STANDARD
    DTSTART:19700101T000000
    RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
    TZOFFSETFROM:+0200
    TZOFFSETTO:+0100
    END:STANDARD
    BEGIN:DAYLIGHT
    DTSTART:19700101T000000
    RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
    TZOFFSETFROM:+0100
    TZOFFSETTO:+0200
    END:DAYLIGHT
    END:VTIMEZONE
    BEGIN:VEVENT
    CREATED:20180714T140805Z
    DTEND;TZID=Europe/Warsaw:20180806T172000
    DTSTAMP:20180714T140805Z
    DTSTART;TZID=Europe/Warsaw:20180806T164000
    LAST-MODIFIED:20180714T140805Z
    SEQUENCE:0
    TRANSP:OPAQUE
    UID:8a2f5a75-618f-4f5f-b708-966f02285a06
    END:VEVENT
    END:VCALENDAR
    )]
    2018-07-14 20:54:01 501 [Event] Parsing iCalendar stream
    2018-07-14 20:54:01 501 Error loading custom timezone aliases: Attempt to invoke virtual method 'int java.io.Reader.read(char[])' on a null object reference
    2018-07-14 20:54:01 501 [syncadapter.SyncManager] Unclassified sync error
    EXCEPTION 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:262)
    	at net.fortuna.ical4j.util.Dates.getInstance(Dates.java:223)
    	at net.fortuna.ical4j.model.Recur.getDates(Recur.java:600)
    	at net.fortuna.ical4j.model.Recur.getDates(Recur.java:520)
    	at net.fortuna.ical4j.model.component.Observance.getLatestOnset(Observance.java:231)
    	at net.fortuna.ical4j.model.component.VTimeZone.getApplicableObservance(VTimeZone.java:252)
    	at net.fortuna.ical4j.model.TimeZone.inDaylightTime(TimeZone.java:137)
    	at java.util.TimeZone.getOffsets(TimeZone.java:246)
    	at java.util.GregorianCalendar.adjustForZoneAndDaylightSavingsTime(GregorianCalendar.java:2916)
    	at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2807)
    	at java.util.Calendar.updateTime(Calendar.java:3397)
    	at java.util.Calendar.getTimeInMillis(Calendar.java:1761)
    	at java.util.Calendar.getTime(Calendar.java:1734)
    	at java.text.SimpleDateFormat.parseInternal(SimpleDateFormat.java:1633)
    	at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1528)
    	at java.text.DateFormat.parse(DateFormat.java:360)
    	at net.fortuna.ical4j.model.DateTime.setTime(DateTime.java:415)
    	at net.fortuna.ical4j.model.DateTime.<init>(DateTime.java:321)
    	at net.fortuna.ical4j.model.property.DateProperty.setValue(DateProperty.java:137)
    	at net.fortuna.ical4j.data.CalendarBuilder$ContentHandlerImpl.propertyValue(CalendarBuilder.java:299)
    	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyParser.parse(CalendarParserImpl.java:282)
    	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyParser.access$1100(CalendarParserImpl.java:229)
    	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyListParser.parse(CalendarParserImpl.java:210)
    	at net.fortuna.ical4j.data.CalendarParserImpl$ComponentParser.parse(CalendarParserImpl.java:422)
    	at net.fortuna.ical4j.data.CalendarParserImpl$ComponentParser.access$900(CalendarParserImpl.java:406)
    	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyListParser.parse(CalendarParserImpl.java:208)
    	at net.fortuna.ical4j.data.CalendarParserImpl.parseCalendar(CalendarParserImpl.java:115)
    	at net.fortuna.ical4j.data.CalendarParserImpl.parseCalendarList(CalendarParserImpl.java:180)
    	at net.fortuna.ical4j.data.CalendarParserImpl.parse(CalendarParserImpl.java:149)
    	at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:198)
    	at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:178)
    	at at.bitfire.ical4android.Event$Companion.fromReader(Event.kt:78)
    	at at.bitfire.ical4android.Event$Companion.fromReader$default(Event.kt:72)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager.processVEvent(CalendarSyncManager.kt:178)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager.access$processVEvent(CalendarSyncManager.kt:39)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager$processRemoteChanges$3$$special$$inlined$use$lambda$1.invoke(CalendarSyncManager.kt:162)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager$processRemoteChanges$3$$special$$inlined$use$lambda$1.invoke(CalendarSyncManager.kt:39)
    	at at.bitfire.davdroid.syncadapter.BaseDavSyncManager.useRemote(BaseDavSyncManager.kt:310)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager$processRemoteChanges$3.invoke(CalendarSyncManager.kt:154)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager$processRemoteChanges$3.invoke(CalendarSyncManager.kt:39)
    	at at.bitfire.davdroid.syncadapter.BaseDavSyncManager.useRemote(BaseDavSyncManager.kt:303)
    	at at.bitfire.davdroid.syncadapter.BaseDavSyncManager.useRemoteCollection(BaseDavSyncManager.kt:316)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager.processRemoteChanges(CalendarSyncManager.kt:149)
    	at at.bitfire.davdroid.syncadapter.SyncManager.performSync(SyncManager.kt:131)
    	at at.bitfire.davdroid.syncadapter.CalendarsSyncAdapterService$CalendarsSyncAdapter.sync(CalendarsSyncAdapterService.kt:56)
    	at at.bitfire.davdroid.syncadapter.SyncAdapterService$SyncAdapter.onPerformSync(SyncAdapterService.kt:97)
    	at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:272)
    




  • This post is deleted!


  • I also encounter the same issue while syncing calendars for 2-3 days. At first it was completely hidden, i.e. no visual information just some short vibrations which I assume to be the indicator for this problem. Manual sync gives the same error as above. I am using android 8.0 on Moto Z. There has not been any system update for a while, so this can’t be the reason! I am using the latest DavDroid (1.11.5-gplay). My backend is latest nextcloud 13.0.4. Do you need any additional information to trace the error? Thunderbird calendar syncs flawlessly…
    christian


  • developer

    @chrstn-hntschl If we could only reproduce this problem… Unfortunately, we don’t have an Android 8.0 device, and in the 8.0 emulator, I can’t reproduce the problem.

    To dig into this, I’d really need to reproduce that.



  • I also experience said problem on Android 8.0.0 (Oneplus 3) with DAVdroid 1.11.5-gplay. The server side backend is Sabre/DAV (like with Nextcloud, Baikal, etc.), though I think that is isn’t a server-side problem (by the information shown in this thread).

    @rfc2822 I can reproduce the exception arbitrarily many times by syncing events to the device that have not existed on the device before. The issue occurs specifically for full-day events (that don’t even have any time zone information defined), like the one listed below. Even events I have created on my device, synced to the server and after that forced to resync to the device (by turning the calendar off and on again) face this kind of issue. Maybe this helps for reproducing/debugging the exception?

    I will also take a look at the issue tracker of ical4j and provide the same information there.

    BEGIN:VCALENDAR
    VERSION:2.0
    PRODID:+//IDN bitfire.at//DAVdroid/1.11.5-gplay ical4j/2.2.0
    BEGIN:VEVENT
    DTSTAMP:20180723T194806Z
    UID:84019e86-b164-45fe-881f-c1a4ec9b70c1
    SUMMARY:#########
    LOCATION:#########
    DTSTART;VALUE=DATE:20180818
    DTEND;VALUE=DATE:20180826
    TRANSP:TRANSPARENT
    END:VEVENT
    END:VCALENDAR
    


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

    I also experience said problem on Android 8.0.0 (Oneplus 3) with DAVdroid 1.11.5-gplay. The server side backend is Sabre/DAV (like with Nextcloud, Baikal, etc.), though I think that is isn’t a server-side problem (by the information shown in this thread).

    I just tried to reinstall DAVdroid, which magically fixed the problem. Maybe the information I provided will still help in fixing the original issue.



  • I installed the latest nextcloud version (13.0.5) and this seemed to have fixed the problem for the moment, which is strange, since it used to work with 13.0.4 as well at some point…


  • developer

    This post is deleted!

 

Maybe you're interested in these topics?

  • 5
  • 2
  • 3
  • 39
  • 1