mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Fixed a crash in calendar parsing when encountering an illegal VEVENT without newlines.
git-svn-id: https://zxing.googlecode.com/svn/trunk@655 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
1d8b533310
commit
bef3c75048
|
@ -35,6 +35,10 @@ public final class CalendarParsedResult extends ParsedResult {
|
||||||
String attendee,
|
String attendee,
|
||||||
String title) {
|
String title) {
|
||||||
super(ParsedResultType.CALENDAR);
|
super(ParsedResultType.CALENDAR);
|
||||||
|
// Start is required, end is not
|
||||||
|
if (start == null) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
validateDate(start);
|
validateDate(start);
|
||||||
validateDate(end);
|
validateDate(end);
|
||||||
this.summary = summary;
|
this.summary = summary;
|
||||||
|
|
|
@ -142,6 +142,9 @@ public final class ParsedReaderResultTestCase extends TestCase {
|
||||||
doTestResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504\r\nEND:VEVENT",
|
doTestResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504\r\nEND:VEVENT",
|
||||||
ParsedResultType.CALENDAR);
|
ParsedResultType.CALENDAR);
|
||||||
doTestResult("BEGIN:VEVENT\r\nDTEND:20080505T\r\nEND:VEVENT", ParsedResultType.TEXT);
|
doTestResult("BEGIN:VEVENT\r\nDTEND:20080505T\r\nEND:VEVENT", ParsedResultType.TEXT);
|
||||||
|
// Make sure illegal entries without newlines don't crash
|
||||||
|
doTestResult("BEGIN:VEVENTSUMMARY:EventDTSTART:20081030T122030ZDTEND:20081030T132030ZEND:VEVENT",
|
||||||
|
ParsedResultType.URI);
|
||||||
doTestResult("BEGIN:VEVENT", ParsedResultType.URI); // See above note on why this is URI
|
doTestResult("BEGIN:VEVENT", ParsedResultType.URI); // See above note on why this is URI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue