aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-12-17 08:01:23 +0100
committerBananeweizen <bananeweizen@gmx.de>2013-12-17 08:01:23 +0100
commit5e4d38b89cde0f8d7660f3b70cb2b02f64f08961 (patch)
treec61e24c2e9173e9860f5d87434e8c2d0655115ac /main/src/cgeo/geocaching
parent235cfd8f5afa62bf4a2c924cec9cd7013874b10e (diff)
downloadcgeo-5e4d38b89cde0f8d7660f3b70cb2b02f64f08961.zip
cgeo-5e4d38b89cde0f8d7660f3b70cb2b02f64f08961.tar.gz
cgeo-5e4d38b89cde0f8d7660f3b70cb2b02f64f08961.tar.bz2
improve parsing of OX parser
Diffstat (limited to 'main/src/cgeo/geocaching')
-rw-r--r--main/src/cgeo/geocaching/connector/ox/OXGPXParser.java14
-rw-r--r--main/src/cgeo/geocaching/files/GPXParser.java3
2 files changed, 17 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java b/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java
index f40a3e8..f72b698 100644
--- a/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java
+++ b/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java
@@ -3,6 +3,9 @@ package cgeo.geocaching.connector.ox;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.files.GPX10Parser;
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jdt.annotation.NonNull;
+
public class OXGPXParser extends GPX10Parser {
private final boolean isDetailed;
@@ -19,5 +22,16 @@ public class OXGPXParser extends GPX10Parser {
cache.setDetailedUpdate(cache.getUpdated());
cache.setDetailed(true);
}
+ removeTitleFromShortDescription(cache);
+ }
+
+ /**
+ * The short description of OX caches contains "title by owner, type(T/D/Awesomeness)". That is a lot of
+ * duplication.
+ *
+ * @param cache
+ */
+ private static void removeTitleFromShortDescription(final @NonNull Geocache cache) {
+ cache.setShortDescription(StringUtils.substringAfterLast(cache.getShortDescription(), ","));
}
}
diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java
index 3341f95..d26a48c 100644
--- a/main/src/cgeo/geocaching/files/GPXParser.java
+++ b/main/src/cgeo/geocaching/files/GPXParser.java
@@ -856,6 +856,9 @@ public abstract class GPXParser extends FileParser {
}
/**
+ * Overwrite this method in a GPX parser sub class to modify the {@link Geocache}, after it has been fully parsed
+ * from the GPX file and before it gets stored.
+ *
* @param cache
* currently imported cache
*/