I am trying to get iCal4j to parse an exported Google .ics calendar file. Unfortunately the parser chokes on a particular value (00001231T000000Z) and throws an exception. My question is how can I get the parser to continue despite the bad data? I am about to edit the source code but is there not a way to configure it to not fail on a date parse error.
I am using ical4j-1.0.5-SNAPSHOT – which I believe is based on the latest code.
My data contains the following event (which appears to be a recurring one):
BEGIN:VEVENT
DTSTART;TZID=America/Vancouver:20101206T060000
DTEND;TZID=America/Vancouver:20101206T150000
RRULE:FREQ=DAILY;UNTIL=20101210T140000Z
DTSTAMP:20121231T143813Z
UID:[deleted]@google.com
CREATED:00001231T000000Z
DESCRIPTION:
LAST-MODIFIED:20110102T020817Z
LOCATION:
SEQUENCE:1
STATUS:CONFIRMED
SUMMARY:iCal4j chokes on this
TRANSP:OPAQUE
END:VEVENT
and dies when it tries to parse this date value (which seems to be a nonsense/bad value)
CREATED:00001231T000000Z
I don’t particularly care if the created field is set or is set to a dummy value. What I care about is the parser continuing and not choking on bad data.
I have tried setting the parsing to relaxed, but somehow this case seems to slip through.
CompatibilityHints.setHintEnabled(
CompatibilityHints.KEY_RELAXED_PARSING, true);
So, how can I make this code more robust to parse errors? Can I supply my own parser? Can I get it to skip records that have errors?
This is actually a regression. Relaxed parsing should have covered this case. Just fixed it in both branch and tip (http://ical4j.hg.sourceforge.net/hgweb/ical4j/ical4j/rev/8c23205afac9).