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



  • Same error, here is what happend:

    1. Object was synced with a VTIMEZONE component but without DAYLIGHT and STANDARD information
    2. Object was changed / fixed and DAYLIGHT and STANDARD information was added
    3. Synctokens on the server were updated
    4. Resync in DAVx5 did not update the calendar entries
    5. Deselecting & selecting forced a complete resync
    6. Now the Exception was thrown
    7. Reinstall DAVx5
    8. Problem solved, exception gone

    Object

    BEGIN:VCALENDAR
    VERSION:2.0
    PRODID:-//Sabre//Sabre VObject 4.1.2//EN
    CALSCALE:GREGORIAN
    BEGIN:VTIMEZONE
    TZID:Europe/Vienna
    BEGIN:STANDARD
    TZOFFSETFROM:+0200
    RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
    DTSTART:19961027T030000
    TZNAME:MEZ
    TZOFFSETTO:+0100
    END:STANDARD
    BEGIN:DAYLIGHT
    TZOFFSETFROM:+0100
    RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
    DTSTART:19810329T020000
    TZNAME:MESZ
    TZOFFSETTO:+0200
    END:DAYLIGHT
    END:VTIMEZONE
    BEGIN:VEVENT
    DTSTAMP:20190110T163429Z
    UID:09941944-08d5-4f7b-8c22-4022d35b5b72.1544062802066
    SUMMARY: Foo
    DESCRIPTION:
    LOCATION:
    URL;VALUE=URI:
    DTSTART;TZID=Europe/Vienna:20190307T140000
    DTEND;TZID=Europe/Vienna:20190307T180000
    END:VEVENT
    END:VCALENDAR
    
    EXCEPTION:
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.TimeZone java.util.Calendar.getTimeZone()' on a null object reference
    	at java.text.DateFormat.getTimeZone(DateFormat.java:704)
    	at net.fortuna.ical4j.model.DateTime.<init>(DateTime.java:236)
    	at net.fortuna.ical4j.model.DateTime.<init>(DateTime.java:244)
    	at net.fortuna.ical4j.model.component.Observance.calculateOnset(Observance.java:323)
    	at net.fortuna.ical4j.model.component.Observance.calculateOnset(Observance.java:309)
    	at net.fortuna.ical4j.model.component.Observance.getLatestOnset(Observance.java:161)
    	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:159)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager.access$processVEvent(CalendarSyncManager.kt:41)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager$downloadRemote$2$1$1.invoke(CalendarSyncManager.kt:144)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager$downloadRemote$2$1$1.invoke(CalendarSyncManager.kt:41)
    	at at.bitfire.davdroid.syncadapter.SyncManager.useRemote(SyncManager.kt:798)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager$downloadRemote$2$1.invoke(CalendarSyncManager.kt:131)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager$downloadRemote$2$1.invoke(CalendarSyncManager.kt:41)
    	at at.bitfire.dav4android.Response$Companion.parse(Response.kt:211)
    	at at.bitfire.dav4android.DavResource$processMultiStatus$2.invoke(DavResource.kt:465)
    	at at.bitfire.dav4android.DavResource.processMultiStatus(DavResource.kt:484)
    	at at.bitfire.dav4android.DavResource.processMultiStatus(DavResource.kt:435)
    	at at.bitfire.dav4android.DavCalendar.multiget(DavCalendar.kt:151)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager$downloadRemote$2.invoke(CalendarSyncManager.kt:130)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager$downloadRemote$2.invoke(CalendarSyncManager.kt:41)
    	at at.bitfire.davdroid.syncadapter.SyncManager.useRemote(SyncManager.kt:787)
    	at at.bitfire.davdroid.syncadapter.SyncManager.useRemoteCollection(SyncManager.kt:808)
    	at at.bitfire.davdroid.syncadapter.CalendarSyncManager.downloadRemote(CalendarSyncManager.kt:129)
    	at at.bitfire.davdroid.syncadapter.SyncManager$syncRemote$1$1.run(SyncManager.kt:447)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    	at java.lang.Thread.run(Thread.java:764)
    
    SOFTWARE INFORMATION
    * at.bitfire.davdroid 2.2.1-ose (262) from com.google.android.packageinstaller
    * com.samsung.android.providers.contacts 2.0.49 (204900100)
    * com.android.providers.calendar 1.0.00.35 (100000035)
    * com.samsung.android.contacts 3.8.25.15 (382500015)
    * com.google.android.contacts 3.3.3.226019458 (2171200) from com.android.vending
    * com.samsung.android.calendar 4.4.04.7 (440400007) from com.sec.android.app.samsungapps
    * com.google.android.calendar 6.0.12-224984167-release (2016050925) from com.android.vending
    
    CONNECTIVITY (at the moment)
    Active connection: WiFi, CONNECTED
    


  • I’ve been getting this error myself using a galaxy S7 edge on Android 8.

    However, this error only shows if I try to sync past events. If I set “Past event time limit” to zero, there are no errors.

    I do kinda want to see past events on my phone though…


  • developer

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

    However, this error only shows if I try to sync past events. If I set “Past event time limit” to zero, there are no errors.

    Probably because then there are no events to synchronize at the moment. As soon as there are new events, it will fail again.

    I do kinda want to see past events on my phone though…

    As far as I know you will have to reinstall DAVx⁵ to get it working, like the others…



  • I did have future events that did sync at the time.

    I reinstalled and it did fix itself.


  • developer

    @Ryonez Thanks for the update!



  • I just ran into this problem as well. No recent updates that I know of. (I’ve been running 8.0 for quite a while, and even my most recent minor OS update is at least 4 weeks ago). It just stopped working and the debug log revealed a

    2019-02-11 23:34:19 46290 [syncadapter.SyncManager] Unclassified sync error
    EXCEPTION java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.TimeZone java.util.Calendar.getTimeZone()' on a null object reference
    	at java.text.DateFormat.getTimeZone(DateFormat.java:704)
    

    Uninstalling and re-installing solved it.
    More problematic was, that it failed completely silently (until I collected debug logs). My calendar went out of sync with the server and I noticed by accident.


  • developer

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

    More problematic was, that it failed completely silently (until I collected debug logs). My calendar went out of sync with the server and I noticed by accident.

    Did you turn off notifications for DAVx⁵ or one of its notification channels?



  • @rfc2822 I do not believe so, but after uninstalling, I can’t be entirely sure.


  • developer



  • @rfc2822 I can offer the whole debug logfile from before the uinstallation if that would be any help? If you would like to take a look at it can email it to you.


  • developer

    @ccoenen Guess it won’t contain any new information, but who knows 🙂 Please send it to play@bitfire.at or upload it here



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

    As already said, we don’t think it is related to DAVx⁵ itself. But reinstalling the app may clear some caches or the calendar storage which is somehow the cause of the problem. Full-day-events don’t have a timezone.

    It seems that reinstalling DAVx5 is not necessary, at least in all cases. I had this issue a long time ago and now again today with two of my calendars containing tasks. Clearing cache of the OpenTasks app (dmfs.tasks) made sync work great again.

    Steps to do this: Navigate to the app info of OpenTasks (or presumably your other favourite tasks or calendar app), tap “Storage” and press the “Clear Cache” button. A follwoing sync of the calendars worked without any issue.

    Anone can confirm this?



Similar topics