mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
Handle VEVENT with malformed GEO
This commit is contained in:
parent
1b898320ac
commit
c77b79d690
|
@ -62,6 +62,9 @@ public final class VEventResultParser extends ResultParser {
|
||||||
longitude = Double.NaN;
|
longitude = Double.NaN;
|
||||||
} else {
|
} else {
|
||||||
int semicolon = geoString.indexOf(';');
|
int semicolon = geoString.indexOf(';');
|
||||||
|
if (semicolon < 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
latitude = Double.parseDouble(geoString.substring(0, semicolon));
|
latitude = Double.parseDouble(geoString.substring(0, semicolon));
|
||||||
longitude = Double.parseDouble(geoString.substring(semicolon + 1));
|
longitude = Double.parseDouble(geoString.substring(semicolon + 1));
|
||||||
|
|
|
@ -138,6 +138,16 @@ public final class CalendarParsedResultTestCase extends Assert {
|
||||||
null, null, null, "20080504T123456Z", null, null, null, -12.345, -45.678);
|
null, null, null, "20080504T123456Z", null, null, null, -12.345, -45.678);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBadGeo() {
|
||||||
|
// Not parsed as VEVENT
|
||||||
|
Result fakeResult = new Result("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\n" +
|
||||||
|
"GEO:-12.345\r\n" +
|
||||||
|
"END:VEVENT\r\nEND:VCALENDAR", null, null, BarcodeFormat.QR_CODE);
|
||||||
|
ParsedResult result = ResultParser.parseResult(fakeResult);
|
||||||
|
assertSame(ParsedResultType.URI, result.getType());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOrganizer() {
|
public void testOrganizer() {
|
||||||
doTest(
|
doTest(
|
||||||
|
|
Loading…
Reference in a new issue