iCalendar parsering - ical4j exception



  • Hello!

    My Davdroid log:
    https://drive.google.com/open?id=1piBL3d3wr6qLw_8kwPRRRUtURsOSZUBX

    I am running Davdroid against my own caldav server. Synchronizing(REPORT) VTODOS seems not to work. When looking Davdroid log, I can find ical4j exceptions. With my iCalandar knowledge I can't find any fatal error in iCalendar content. Could some look my log, if you could say what's going wrong here.

    regards
    Juha

     [syncadapter.TasksSyncManager] Received invalid iCalendar, ignoring
    EXCEPTION at.bitfire.ical4android.InvalidCalendarException: Couldn't parse iCalendar resource
    	at at.bitfire.ical4android.Task$Companion.fromReader(Task.kt:71)
    	at at.bitfire.davdroid.syncadapter.TasksSyncManager.processVTodo(TasksSyncManager.kt:165)
    	at at.bitfire.davdroid.syncadapter.TasksSyncManager.downloadRemote(TasksSyncManager.kt:149)
    	at at.bitfire.davdroid.syncadapter.SyncManager.performSync(SyncManager.kt:159)
    	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:259)
    Caused by: net.fortuna.ical4j.data.ParserException: Error at line 30:net.fortuna.ical4j.model.component.Daylight cannot be cast to net.fortuna.ical4j.model.component.VAlarm
    	at net.fortuna.ical4j.data.CalendarParserImpl.parse(CalendarParserImpl.java:158)
    	at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:198)
    	at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:178)
    	at at.bitfire.ical4android.Task$Companion.fromReader(Task.kt:69)
    	... 6 more
    Caused by: java.lang.ClassCastException: net.fortuna.ical4j.model.component.Daylight cannot be cast to net.fortuna.ical4j.model.component.VAlarm
    	at net.fortuna.ical4j.data.CalendarBuilder$ContentHandlerImpl.endComponent(CalendarBuilder.java:236)
    	at net.fortuna.ical4j.data.CalendarParserImpl$ComponentParser.parse(CalendarParserImpl.java:444)
    	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$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$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)
    	... 9 more
    
    Sample iCalandar:
    DAV:getcontenttype = GetContentType(type=text/calendar;component=vtodo)]
    2018-01-09 15:21:46 3 [DavResource] Ignoring unknown property DAV:status
    2018-01-09 15:21:46 3 [DavResource] Received <response> for http://10.0.2.2/juha/neo/rush8crr2a203728.ics
    	PARAMETER #0 = [DAV:getetag = 723be14b4c09bc2eb28e7f6209a2d26b, urn:ietf:params:xml:ns:caldavcalendar-data = CalendarData(iCalendar=BEGIN:VCALENDAR
    VERSION:2.0
    BEGIN:VTIMEZONE
    LAST-MODIFIED:20040110T032845Z
    TZID:Europe/Kiev
    BEGIN:DAYLIGHT
    DTSTART:20000404T020000
    RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
    TZOFFSETFROM:+0200
    TZOFFSETTO:+0300
    END:DAYLIGHT
    BEGIN:STANDARD
    DTSTART:20001026T020000
    RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
    TZNAME:EST
    TZOFFSETFROM:+0300
    TZOFFSETTO:+0200
    END:STANDARD
    END:VTIMEZONE
    
    BEGIN:VTODO
    BEGIN:VTIMEZONE
    LAST-MODIFIED:20040110T032845Z
    TZID:Europe/Kiev
    BEGIN:DAYLIGHT
    DTSTART:20000404T020000
    RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
    TZOFFSETFROM:+0200
    TZOFFSETTO:+0300
    END:DAYLIGHT
    BEGIN:STANDARD
    DTSTART:20001026T020000
    RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
    TZNAME:EST
    TZOFFSETFROM:+0300
    TZOFFSETTO:+0200
    END:STANDARD
    END:VTIMEZONE
    DTSTAMP:20170728T073134
    DTSTART;TZID=Europe/Kiev:20160415T000000
    DTEND;TZID=Europe/Kiev:20160415T143000
    DUE;TZID=Europe/Kiev:20160416T235959
    LAST-MODIFIED:20170728T103134
    STATUS:NEEDS-ACTION
    SUMMARY:Perjantain RUSH muuttui Outlookissa
    UID:19970901T130000Z-123404@host.com
    END:VTODO
    END:VCALENDAR
    ), DAV:getcontenttype = GetContentType(type=text/calendar;component=vtodo)]
    

  • developer

    http://10.0.2.2/juha/neo/rush8crr2a203728.ics seems to be an invalid iCalendar. Have a look at line 30, but the error may has its root in another line. Can you post this resource (without private data)?

    How did you create these tasks?

    Does synchronization work when you create the task on your Android device?



  • This iCalandar is generated by a server that I have written myself.

    <D:multistatus xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:D="DAV:">
    <D:response>
    <D:href>/juha/neo/rush8crr2a203728.ics</D:href>
    <D:propstat>
    <D:prop>
    <D:getetag>"723be14b4c09bc2eb28e7f6209a2d26b"</D:getetag>
    <C:calendar-data>
    BEGIN:VCALENDAR VERSION:2.0 BEGIN:VTIMEZONE LAST-MODIFIED:20040110T032845Z TZID:Europe/Kiev BEGIN:DAYLIGHT DTSTART:20000404T020000 RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 TZOFFSETFROM:+0200 TZOFFSETTO:+0300 END:DAYLIGHT BEGIN:STANDARD DTSTART:20001026T020000 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 TZNAME:EST TZOFFSETFROM:+0300 TZOFFSETTO:+0200 END:STANDARD END:VTIMEZONE BEGIN:VTODO BEGIN:VTIMEZONE LAST-MODIFIED:20040110T032845Z TZID:Europe/Kiev BEGIN:DAYLIGHT DTSTART:20000404T020000 RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 TZOFFSETFROM:+0200 TZOFFSETTO:+0300 END:DAYLIGHT BEGIN:STANDARD DTSTART:20001026T020000 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 TZNAME:EST TZOFFSETFROM:+0300 TZOFFSETTO:+0200 END:STANDARD END:VTIMEZONE DTSTAMP:20170728T073134 DTSTART;TZID=Europe/Kiev:20160415T000000 DTEND;TZID=Europe/Kiev:20160415T143000 DUE;TZID=Europe/Kiev:20160416T235959 LAST-MODIFIED:20170728T103134 STATUS:NEEDS-ACTION SUMMARY:Perjantain RUSH muuttui Outlookissa UID:19970901T130000Z-123404@host.com END:VTODO END:VCALENDAR
    </C:calendar-data>
    <D:displayname>Perjantain RUSH muuttui Outlookissa</D:displayname>
    <D:getcontenttype>text/calendar;component=vtodo</D:getcontenttype>
    <D:status>HTTP/1.1 200 OK</D:status>
    </D:prop>
    </D:propstat>
    </D:response>
    </D:multistatus>


  • developer

    It seems the iCalendar is invalid. Please double-check it, including the VTIMEZONEs. You may also use a validator.

    Also, please use correct formatting for such data. It's really hard to read it otherwise.

    If you think that your iCalendar is correct and it's a DAVdroid error, please provide an iCalendar file to reproduce the problem.



  • Now I get it to work. Datetime formats where wrong. iCalendar.org validator did not detect these problems. I find this errors using severinghaus.org validator here:. It is based on same iCal4j library.