Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Weird ParserException error

Help
2013-02-21
2013-06-05
  • Pascal Robert
    Pascal Robert
    2013-02-21

    I have a really weird ParserException. I found about it because I had to deploy an app that I work on, and the Parser exception happened on my deployment box (CentOS Linux with Java 1.7) and I didn't get that exception in development on my Mac (also running Java 1.7).

    The exception:

    net.fortuna.ical4j.data.ParserException: Error at line 9:Expected , read
    at net.fortuna.ical4j.data.CalendarParserImpl.assertToken(CalendarParserImpl.java:427)
    at net.fortuna.ical4j.data.CalendarParserImpl.access$0(CalendarParserImpl.java:423)
    at net.fortuna.ical4j.data.CalendarParserImpl$ParameterParser.parse(CalendarParserImpl.java:304)
    at net.fortuna.ical4j.data.CalendarParserImpl$ParameterParser.access$1(CalendarParserImpl.java:291)
    at net.fortuna.ical4j.data.CalendarParserImpl$ParameterListParser.parse(CalendarParserImpl.java:277)
    at net.fortuna.ical4j.data.CalendarParserImpl$PropertyParser.parse(CalendarParserImpl.java:213)
    at net.fortuna.ical4j.data.CalendarParserImpl$PropertyParser.access$1(CalendarParserImpl.java:200)
    at net.fortuna.ical4j.data.CalendarParserImpl$PropertyListParser.parse(CalendarParserImpl.java:178)
    at net.fortuna.ical4j.data.CalendarParserImpl$ComponentParser.parse(CalendarParserImpl.java:390)
    at net.fortuna.ical4j.data.CalendarParserImpl$ComponentParser.access$1(CalendarParserImpl.java:376)
    at net.fortuna.ical4j.data.CalendarParserImpl$PropertyListParser.parse(CalendarParserImpl.java:175)
    at net.fortuna.ical4j.data.CalendarParserImpl.parse(CalendarParserImpl.java:125)
    at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:210)
    at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:191)
    at net.fortuna.ical4j.connector.dav.CalDavCalendarCollection.getObjectsByFilter(CalDavCalendarCollection.java:667)
    at net.fortuna.ical4j.connector.dav.CalDavCalendarCollection.getEventsForTimePeriod(CalDavCalendarCollection.java:591)

    I wasn't able to replicate this problem until I remembered that in Eclipse, ical4j-connector was linked as a Project in the build path. I removed that so that my framework only use the jar and bang!, I got the exception in development too!

    What I don't understand is that my framework contains the same code in the jar (I ran 'mvn package' in ical4j-connector and added the resulting jar in my framework), so it should be the exact same code.

     
  • Pascal Robert
    Pascal Robert
    2013-02-21

    I downloaded the .ics from the CalDAV server, calling this:

          fin = new FileInputStream("/Users/probert/Downloads/20130221T164946Z-1@fdb4-5bac-8d1e-35af-a86f-701f-60fa-8258.ics");
          CalendarBuilder builder = new CalendarBuilder();
          Calendar calendar = builder.build(fin);

    and it works fine. I guess something is wrong in ical4j-connector.

     
  • Pascal Robert
    Pascal Robert
    2013-02-21

    Ok, so I did some printout, and I really don't understanding why it's failing.  The iCalendar object from the CalDAV response:

    BEGIN:VCALENDAR
    VERSION:2.0
    CALSCALE:GREGORIAN
    PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
    BEGIN:VEVENT
    UID:20130221T164946Z-1@fdb4:5bac:8d1e:35af:a86f:701f:60fa:8258
    DTSTART:20130220T110000
    DTEND:20130220T113000
    ATTENDEE;CN=Formation professionnelle;CUTYPE=RESOURCE;PARTSTAT=ACCEPTED;RO
    LE=REQ-PARTICIPANT:urn:uuid:44EFAE32-F005-45FD-B700-138520923ECB
    ATTENDEE;CN=Calendriers;CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED;ROLE=REQ-PARTI
    CIPANT;RSVP=FALSE:urn:uuid:461852B4-626B-4FEB-9F2D-29F5F119D0A5
    ATTENDEE;CN=172-Salle de montage;CUTYPE=ROOM;PARTSTAT=ACCEPTED;ROLE=REQ-PA
    RTICIPANT:urn:uuid:04DEA621-5D3F-4028-B9E1-7BDA9ABA16A3
    ATTENDEE;CN=Pascal Robert;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;ROLE=NON
    -PARTICIPANT;RSVP=TRUE:mailto:probert@macti.ca
    DESCRIPTION:Test Pascal
    DTSTAMP:20130221T164946Z
    LOCATION:172-Salle de montage
    ORGANIZER;CN=Calendriers;CUTYPE=INDIVIDUAL;SCHEDULE-STATUS=1.2:urn:uuid:46
    1852B4-626B-4FEB-9F2D-29F5F119D0A5
    SEQUENCE:1
    SUMMARY:Nouvelle formation
    TRANSP:OPAQUE
    END:VEVENT
    END:VCALENDAR

     
  • Pascal Robert
    Pascal Robert
    2013-02-21

    Look like I had to add the CompatibilityHints. But why it was working when my framework was linked to the ical4j-connector and why it works without the CompatibilityHints when parsing a file is beyond me.