diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2012-11-10 13:32:12 +0100 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2012-11-10 13:32:12 +0100 |
commit | 3fcc78ed24d987bca508bd2ba126d4a274680643 (patch) | |
tree | e850dd22e46cdfc8b2ca1181935c8e32b0aeb0bd /main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java | |
parent | c92010b00ae5f407d5deaceb4b112edb0af20abc (diff) | |
download | cgeo-3fcc78ed24d987bca508bd2ba126d4a274680643.zip cgeo-3fcc78ed24d987bca508bd2ba126d4a274680643.tar.gz cgeo-3fcc78ed24d987bca508bd2ba126d4a274680643.tar.bz2 |
fix #2089: c:geo crashes when importing large GPX file
Diffstat (limited to 'main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java')
-rw-r--r-- | main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java b/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java index 7ed6073..17be540 100644 --- a/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java +++ b/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java @@ -2,9 +2,6 @@ package cgeo.geocaching.connector.ox; import cgeo.geocaching.StoredList; import cgeo.geocaching.cgCache; -import cgeo.geocaching.cgeoapplication; -import cgeo.geocaching.enumerations.LoadFlags.SaveFlag; -import cgeo.geocaching.files.GPX10Parser; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.GeopointFormatter; import cgeo.geocaching.network.Network; @@ -13,11 +10,11 @@ import cgeo.geocaching.utils.CryptUtils; import cgeo.geocaching.utils.Log; import ch.boye.httpclientandroidlib.HttpResponse; + import org.apache.commons.collections.CollectionUtils; import java.util.Collection; import java.util.Collections; -import java.util.EnumSet; public class OpenCachingApi { @@ -43,21 +40,11 @@ public class OpenCachingApi { } Collection<cgCache> caches; try { - caches = new GPX10Parser(StoredList.STANDARD_LIST_ID).parse(response.getEntity().getContent(), null); + caches = new OXGPXParser(StoredList.STANDARD_LIST_ID, isDetailed).parse(response.getEntity().getContent(), null); } catch (Exception e) { Log.e("Error importing from OpenCaching.com", e); return Collections.emptyList(); } - for (cgCache cache : caches) { - cache.setUpdated(System.currentTimeMillis()); - if (isDetailed) { - cache.setDetailedUpdate(cache.getUpdated()); - cache.setDetailed(true); - } - - // save full detailed caches - cgeoapplication.getInstance().saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB)); - } return caches; } |