@Gregor-B, probably my recent experience will help here: https://forums.bitfire.at/post/11354
Cheers,
Schiri
Hello,
I got a NullPointerException in davdroid while parsing an ics with a VJOURNAL entry.
The logcat output is:
29150 E/AndroidRuntime(20206): FATAL EXCEPTION: SyncAdapterThread-1
29151 E/AndroidRuntime(20206): java.lang.NullPointerException
29152 E/AndroidRuntime(20206): at at.bitfire.davdroid.resource.Event.hasNoTime(Event.java:299)
29153 E/AndroidRuntime(20206): at at.bitfire.davdroid.resource.Event.isAllDay(Event.java:286)
29154 E/AndroidRuntime(20206): at at.bitfire.davdroid.resource.LocalCalendar.buildEntry(LocalCalendar.java:407)
29155 E/AndroidRuntime(20206): at at.bitfire.davdroid.resource.LocalCollection.add(LocalCollection.java:162)
29156 E/AndroidRuntime(20206): at at.bitfire.davdroid.syncadapter.SyncManager.synchronize(SyncManager.java:143)
29157 E/AndroidRuntime(20206): at at.bitfire.davdroid.syncadapter.DavSyncAdapter.onPerformSync(DavSyncAdapter.java:70)
29158 E/AndroidRuntime(20206): at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:254)
The ics is
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ownCloud//NONSGML Journal 0.3.2//EN
BEGIN:VJOURNAL
DTSTART;VALUE=DATE-TIME;TZID=UTC:20130706T193511
CREATED;VALUE=DATE-TIME:20130706T193511Z
UID:4fe473a2d0
ORGANIZER:MAILTO:XXX@XXX.XXX
SUMMARY:XXX
LAST-MODIFIED;VALUE=DATE-TIME:20130706T193526Z
DTSTAMP;VALUE=DATE-TIME:20130706T193526Z
DESCRIPTION:XXX\n\nXXX\n\n
END:VJOURNAL
END:VCALENDAR
As a fix you could throw a ParseException so the VJOURNAL will not get parsed.
at/bitfire/davdroid/resource/Event.java:120
// event
ComponentList events = ical.getComponents(Component.VEVENT);
if (events == null || events.isEmpty())
{
throw new ParseException("",0);
}
I don’t have tested this, cause I don’t get the source compiled.
Thank you for this greate app
This check is already here: https://github.com/rfc2822/davdroid/blob/b35273a6d56aeada4fe00dbd97895b8a3d5070b2/src/at/bitfire/davdroid/resource/Event.java#L123
Maybe the event is interpreted later although it’s empty, I’ll have a look.
Can’t verify with most recent version, so I’ll close this.
Can you check if this occurs with the newest version and if it does, please post again?
As far as I understand your code, the Event get parsed in
https://github.com/rfc2822/davdroid/blob/b35273a6d56aeada4fe00dbd97895b8a3d5070b2/src/at/bitfire/davdroid/resource/RemoteCollection.java#L90
and in line 91 added to the resource. So you need some logic later to ignore other entries than VEVENT.
With the exception thrown those got ignored.
It fixed some strange behaviour where i got “Kalenderspeicher angehalten” or a android core deamon got killed after a “sync now”
The parseEntity method returns if there’s no VEVENT (as posted above).
So, does the newest version still have the problem?