Reputation: 10927
I'm trying to read a calendar feed from http://meetup.com/, but it seems that iCal4j is unable to deal with linebreaks in X-ORIGINAL-URL attributes: it fails on this line:
X-ORIGINAL-URL:http://www.meetup.com/chicagoscala/calendar/ical/The+Chicago
-Area+Scala+Enthusiasts+(CASE)+Meetup+Group/
with this exception:
net.fortuna.ical4j.data.ParserException: Error at line 7: Illegal property [ -AREA+SCALA+ENTHUSIASTS+(CASE)+MEETUP+GROUP/]
at net.fortuna.ical4j.data.CalendarParserImpl.parse(CalendarParserImpl.java:133)
at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:174)
at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:155)
I filed a bug for it, but I didn't get any response yet. Is this a known problem?
BTW, this is a snippet of a hexdump of that file:
00000060 4e 0a 58 2d 4f 52 49 47 49 4e 41 4c 2d 55 52 4c |N.X-ORIGINAL-URL|
00000070 3a 68 74 74 70 3a 2f 2f 77 77 77 2e 6d 65 65 74 |:http://www.meet|
00000080 75 70 2e 63 6f 6d 2f 63 68 69 63 61 67 6f 73 63 |up.com/chicagosc|
00000090 61 6c 61 2f 63 61 6c 65 6e 64 61 72 2f 69 63 61 |ala/calendar/ica|
000000a0 6c 2f 54 68 65 2b 43 68 69 63 61 67 6f 0a 20 2d |l/The+Chicago. -|
000000b0 41 72 65 61 2b 53 63 61 6c 61 2b 45 6e 74 68 75 |Area+Scala+Enthu|
000000c0 73 69 61 73 74 73 2b 28 43 41 53 45 29 2b 4d 65 |siasts+(CASE)+Me|
Upvotes: 6
Views: 1713
Reputation: 10927
Ok, passing in an UnfoldingReader yourself seems to do the trick. If you set the buffer size large enough, it will be able to restore the value correctly. Strange.
reader = new UnfoldingReader(new InputStreamReader(uri.toURL().openStream()), 3000);
return new CalendarBuilder().build(reader);
I also set ical4j.properties to this:
ical4j.unfolding.relaxed=true
Not sure if that made a huge difference, but at least it works.
Upvotes: 5