Made calendar event parsing more robust, and also reject non-calendar contents a little faster.

git-svn-id: https://zxing.googlecode.com/svn/trunk@604 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
dswitkin 2008-10-08 15:37:38 +00:00
parent 13c08aedaf
commit 45677f2bb2

View file

@ -35,11 +35,13 @@ final class VEventResultParser extends ResultParser {
return null;
}
int vEventStart = rawText.indexOf("BEGIN:VEVENT");
int vEventEnd = rawText.indexOf("END:VEVENT");
if (vEventStart < 0 || vEventEnd < 0) {
if (vEventStart < 0) {
return null;
}
int vEventEnd = rawText.indexOf("END:VEVENT");
if (vEventEnd < 0) {
return null;
}
rawText = rawText.substring(vEventStart + 14, vEventEnd); // skip over BEGIN:VEVENT\r\n at start
String summary = VCardResultParser.matchSingleVCardPrefixedField("SUMMARY", rawText, true);
String start = VCardResultParser.matchSingleVCardPrefixedField("DTSTART", rawText, true);