diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2012-06-23 11:26:17 +0200 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2012-06-23 11:26:17 +0200 |
commit | cc95843b37a93112de84daf370a44af49db1116f (patch) | |
tree | f64c6609fdf4889ba8f46aebf376c646e00b0978 /main/src | |
parent | f0d8d99bc758694dfdd2dae4b2abeeec4f0cc7c6 (diff) | |
download | cgeo-cc95843b37a93112de84daf370a44af49db1116f.zip cgeo-cc95843b37a93112de84daf370a44af49db1116f.tar.gz cgeo-cc95843b37a93112de84daf370a44af49db1116f.tar.bz2 |
fix #1812: GPX-Import fails at name with quotes
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/cgeo/geocaching/files/GPXParser.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java index 76ca111..fbe1b65 100644 --- a/main/src/cgeo/geocaching/files/GPXParser.java +++ b/main/src/cgeo/geocaching/files/GPXParser.java @@ -51,6 +51,7 @@ public abstract class GPXParser extends FileParser { */ private static final Pattern patternGeocode = Pattern.compile("([A-Z][0-9A-Z]+)"); private static final Pattern patternGuid = Pattern.compile(".*" + Pattern.quote("guid=") + "([0-9a-z\\-]+)", Pattern.CASE_INSENSITIVE); + private static final Pattern patternUrlGeocode = Pattern.compile(".*" + Pattern.quote("wp=") + "([A-Z][0-9A-Z]+)", Pattern.CASE_INSENSITIVE); /** * supported groundspeak extensions of the GPX format */ @@ -228,7 +229,7 @@ public abstract class GPXParser extends FileParser { static Date parseDate(String inputUntrimmed) throws ParseException { String input = inputUntrimmed.trim(); - // remove milli seconds to reduce number of needed patterns + // remove milliseconds to reduce number of needed patterns final Matcher matcher = PATTERN_MILLISECONDS.matcher(input); input = matcher.replaceFirst(""); if (input.contains("Z")) { @@ -422,6 +423,11 @@ public abstract class GPXParser extends FileParser { cache.setGuid(guid); } } + final Matcher matcherCode = patternUrlGeocode.matcher(url); + if (matcherCode.matches()) { + String geocode = matcherCode.group(1); + cache.setGeocode(geocode); + } } }); |