Exception when vCard values contain colon
Brought to you by:
fortuna
Parsing this VCard:
BEGIN:VCARD
UID:123:456.vcf
FN:Test Test
END:VCARD
fails with:
net.fortuna.ical4j.data.ParserException: Error at line 2:Error parsing line
at net.fortuna.ical4j.vcard.VCardBuilder.build(VCardBuilder.java:200)
at net.fortuna.ical4j.vcard.VCardBuilder.build(VCardBuilder.java:137)
at Test.main(Test.java:32)
Caused by: java.net.URISyntaxException: Illegal character in scheme name at index 0: 123:456.vcf
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.checkChar(URI.java:3012)
at java.net.URI$Parser.parse(URI.java:3028)
at java.net.URI.<init>(URI.java:595)
at net.fortuna.ical4j.vcard.property.Uid.<init>(Uid.java:80)
at net.fortuna.ical4j.vcard.property.Uid$Factory.createProperty(Uid.java:113)
at net.fortuna.ical4j.vcard.property.Uid$Factory.createProperty(Uid.java:1)
at net.fortuna.ical4j.vcard.VCardBuilder.parseProperty(VCardBuilder.java:261)
at net.fortuna.ical4j.vcard.VCardBuilder.build(VCardBuilder.java:197)
... 2 more
This is because new URI("123:456.vcf") throws a URISyntaxException because it thinks 123 is the URI scheme, and schemes musn't begin with a number.
(I found this issue because the widely-used Zimbra server returns such Vcards with colons in UID values.)