aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorBananeweizen <Bananeweizen@gmx.de>2012-11-27 08:27:35 +0100
committerBananeweizen <Bananeweizen@gmx.de>2012-11-27 08:30:39 +0100
commit06608af852274ce5c394e647795c1763e2509080 (patch)
tree3063ea69bf981320d074f407628cec095d635047 /main/src
parentc12ea0b48ac22c1ca6aec4897eb8eff08a0b747b (diff)
downloadcgeo-06608af852274ce5c394e647795c1763e2509080.zip
cgeo-06608af852274ce5c394e647795c1763e2509080.tar.gz
cgeo-06608af852274ce5c394e647795c1763e2509080.tar.bz2
fix #2202: logs duplicated after importing GPX twice
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/cgCache.java23
-rw-r--r--main/src/cgeo/geocaching/files/GPXParser.java5
2 files changed, 23 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java
index bb167bd..7035d65 100644
--- a/main/src/cgeo/geocaching/cgCache.java
+++ b/main/src/cgeo/geocaching/cgCache.java
@@ -19,6 +19,7 @@ import cgeo.geocaching.enumerations.LoadFlags.RemoveFlag;
import cgeo.geocaching.enumerations.LoadFlags.SaveFlag;
import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.enumerations.WaypointType;
+import cgeo.geocaching.files.GPXParser;
import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.network.HtmlImage;
import cgeo.geocaching.utils.CancellableHandler;
@@ -130,6 +131,26 @@ public class cgCache implements ICache, IWaypoint {
private Handler changeNotificationHandler = null;
+ /**
+ * Create a new cache. To be used everywhere except for the GPX parser
+ */
+ public cgCache() {
+ // empty
+ }
+
+ /**
+ * Cache constructor to be used by the GPX parser only. This constructor explicitly sets several members to empty
+ * lists.
+ *
+ * @param gpxParser
+ */
+ public cgCache(GPXParser gpxParser) {
+ setReliableLatLon(true);
+ setAttributes(Collections.<String> emptyList());
+ setWaypoints(Collections.<cgWaypoint> emptyList(), false);
+ setLogs(Collections.<LogEntry> emptyList());
+ }
+
public void setChangeNotificationHandler(Handler newNotificationHandler) {
changeNotificationHandler = newNotificationHandler;
}
@@ -1612,4 +1633,4 @@ public class cgCache implements ICache, IWaypoint {
}
return result;
}
-} \ No newline at end of file
+}
diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java
index 221aa1e..b9d3f53 100644
--- a/main/src/cgeo/geocaching/files/GPXParser.java
+++ b/main/src/cgeo/geocaching/files/GPXParser.java
@@ -854,10 +854,7 @@ public abstract class GPXParser extends FileParser {
desc = null;
cmt = null;
- cache = new cgCache();
- cache.setReliableLatLon(true);
- cache.setAttributes(new ArrayList<String>());
- cache.setWaypoints(new ArrayList<cgWaypoint>(), false);
+ cache = new cgCache(this);
for (int i = 0; i < userData.length; i++) {
userData[i] = null;
}