Skip to content

Commit

Permalink
GPX-Corpus: Do not fail on SAXParseException as many documents are br…
Browse files Browse the repository at this point in the history
…oken
  • Loading branch information
centic9 committed Apr 2, 2024
1 parent bb33970 commit 3f67a3b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ public void testParseAllLocalFiles() throws IOException {
str.startsWith("Moved Permanently") ||
str.startsWith("BCFZ") ||
str.startsWith("Found") ||
str.startsWith("302 Found") ||
str.toLowerCase().startsWith("<!doctype html") ||
str.toLowerCase().startsWith("<html") ||
str.toUpperCase().startsWith("GEOMETRYCOLLECTION") ||
Expand All @@ -381,8 +382,9 @@ public void testParseAllLocalFiles() throws IOException {
} catch (IOException | RuntimeException e) {
// ignore some broken files
String stackTrace = ExceptionUtils.getStackTrace(e);
if (stackTrace.contains("Expected to have tag 'lat' and 'lon'") ||
stackTrace.contains("For input string")) {
if (e.getCause() instanceof SAXParseException ||
stackTrace.contains("Expected to have tag 'lat' and 'lon'") ||
stackTrace.contains("For input string")) {
System.out.println("Skipping broken file " + gpxFile);
return;
}
Expand Down

0 comments on commit 3f67a3b

Please sign in to comment.