openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.71k forks source link

[caldav io] IllegalArgumentException stops processing further entries #5932

Open UrsusS opened 4 years ago

UrsusS commented 4 years ago

In my caldav database I have a malformed entry, which causes an IllegalArgumentException. Unfortunately this Exceptions has the consequence that no further entries in the database are processed. Is it possible to ignore just this malformed entry and proceed with the following entries? Due to the consequence of this Exception, it shouldn't be logged as WARN, but as an ERROR

18-Jan-2020 13:52:53.635 [DEBUG] [caldav.internal.job.EventReloaderJob] - loading resource: /caldav.php/HA/calendar/02e13e90ece9d85198959208faad21902fb1f1b8.ics (FSchangedTS not valid)
18-Jan-2020 13:52:53.669 [TRACE] [caldav.internal.job.EventReloaderJob] - Raw URL: http://192.168.43.2/caldav.php/HA/calendar/
18-Jan-2020 13:52:53.702 [TRACE] [caldav.internal.job.EventReloaderJob] - URL after encoding: http://192.168.43.2/caldav.php/HA/calendar/02e13e90ece9d85198959208faad21902fb1f1b8.ics
18-Jan-2020 13:52:53.997 [TRACE] [caldav.internal.job.EventReloaderJob] - loadFrom = 2020-01-18T13:52:53.997+01:00
18-Jan-2020 13:52:54.036 [TRACE] [caldav.internal.job.EventReloaderJob] - loadTo = 2020-01-25T13:52:54.036+01:00
18-Jan-2020 13:52:54.080 [TRACE] [caldav.internal.job.EventReloaderJob] - loading event: 02e13e90ece9d85198959208faad21902fb1f1b8:Abschlußball
18-Jan-2020 13:52:54.125 [TRACE] [caldav.internal.job.EventReloaderJob] - overriding lastmodified from file FS (2020-01-18T13:52:53.516+01:00) with event's last-modified property (2020-01-05T13:34:21.000+01:00)
18-Jan-2020 13:52:54.170 [WARN ] [caldav.internal.job.EventReloaderJob] - Error while loading calendar entries: Range start must be before range end
java.lang.IllegalArgumentException: Range start must be before range end
    at net.fortuna.ical4j.model.DateRange.<init>(DateRange.java:71) ~[ical4j-2.2.5.jar:?]
    at net.fortuna.ical4j.model.Period.<init>(Period.java:88) ~[ical4j-2.2.5.jar:?]
    at net.fortuna.ical4j.model.Component.calculateRecurrenceSet(Component.java:374) ~[ical4j-2.2.5.jar:?]
    at org.openhab.io.caldav.internal.job.EventReloaderJob.loadEvents(EventReloaderJob.java:404) ~[bundleFile:?]
    at org.openhab.io.caldav.internal.job.EventReloaderJob.loadEvents(EventReloaderJob.java:325) ~[bundleFile:?]
    at org.openhab.io.caldav.internal.job.EventReloaderJob.execute(EventReloaderJob.java:141) [bundleFile:?]
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [bundleFile:?]
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [bundleFile:?]

The calendar entry is:

BEGIN:VEVENT
UID:02e13e90ece9d85198959208faad21902fb1f1b8
DTSTAMP:20200105T081200Z
DTSTART;TZID=Europe/Berlin:20200214T190000
DTEND;VALUE=DATE:20200214
SEQUENCE:2
SUMMARY:Abschlußball
LOCATION:B..
TRANSP:OPAQUE
CLASS:PUBLIC
CREATED:20200105T123421Z
LAST-MODIFIED:20200105T123421Z
BEGIN:VALARM
X-EVOLUTION-ALARM-UID:2693e001f43eab15bbc6a9fa5b05fcc5ccb30de8
ACTION:DISPLAY
DESCRIPTION:Abschlußball
TRIGGER;RELATED=START:-PT15M
END:VALARM
END:VEVENT

DTSTART and DTEND don't fit together, so the error is correct.