From bb33970e56713ef89297eb4f078818efca9b6246 Mon Sep 17 00:00:00 2001
From: Dominik Stadler <dominik.stadler@gmx.at>
Date: Sun, 31 Mar 2024 12:19:16 +0200
Subject: [PATCH] Adjust local corpus-test slightly to ignore some more broken
 files

---
 .../dstadler/commons/gpx/GPXTrackpointsParserTest.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/test/java/org/dstadler/commons/gpx/GPXTrackpointsParserTest.java b/src/test/java/org/dstadler/commons/gpx/GPXTrackpointsParserTest.java
index c42d6e1f..3c2ebbc3 100644
--- a/src/test/java/org/dstadler/commons/gpx/GPXTrackpointsParserTest.java
+++ b/src/test/java/org/dstadler/commons/gpx/GPXTrackpointsParserTest.java
@@ -22,6 +22,7 @@
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.apache.commons.lang3.mutable.MutableInt;
 import org.apache.commons.lang3.time.FastDateFormat;
 import org.dstadler.commons.testing.TestHelpers;
@@ -365,6 +366,8 @@ public void testParseAllLocalFiles() throws IOException {
 						String str = FileUtils.readFileToString(gpxFile, "UTF-8").trim();
 						if (str.contains("301 Moved Permanently") ||
 							str.startsWith("Moved Permanently") ||
+							str.startsWith("BCFZ") ||
+							str.startsWith("Found") ||
 							str.toLowerCase().startsWith("<!doctype html") ||
 							str.toLowerCase().startsWith("<html") ||
 							str.toUpperCase().startsWith("GEOMETRYCOLLECTION") ||
@@ -376,6 +379,13 @@ public void testParseAllLocalFiles() throws IOException {
 						final SortedMap<Long, TrackPoint> trackPoints = GPXTrackpointsParser.parseContent(gpxFile);
 						assertNotNull(trackPoints);
 					} 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")) {
+							System.out.println("Skipping broken file " + gpxFile);
+							return;
+						}
 						throw new RuntimeException("Failed to process " + gpxFile, e);
 					}
 				});