diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2013-01-13 10:30:57 +0100 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2013-01-13 10:30:57 +0100 |
| commit | ed7eaa1b52063cb46e9b2e0281da115ca05f9677 (patch) | |
| tree | 022f73dce9243977359e3eb02ecf6f916501f29d /main/src | |
| parent | 9c62d0a0d10a7345210b2d06da5dbc126c68977e (diff) | |
| parent | 89bd78c4e3233788a3910443b1d7de3d2857c7c6 (diff) | |
| download | cgeo-ed7eaa1b52063cb46e9b2e0281da115ca05f9677.zip cgeo-ed7eaa1b52063cb46e9b2e0281da115ca05f9677.tar.gz cgeo-ed7eaa1b52063cb46e9b2e0281da115ca05f9677.tar.bz2 | |
Merge remote-tracking branch 'origin/release'
Conflicts:
main/src/cgeo/geocaching/maps/CGeoMap.java
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/maps/CGeoMap.java | 8 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java | 19 |
2 files changed, 16 insertions, 11 deletions
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 47ca240..5d98f3f 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -496,9 +496,11 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto if (!CollectionUtils.isEmpty(dirtyCaches)) { for (String geocode : dirtyCaches) { cgCache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS); - // remove to update the cache - caches.remove(cache); - caches.add(cache); + if (cache != null) { + // remove to update the cache + caches.remove(cache); + caches.add(cache); + } } dirtyCaches.clear(); // Update display diff --git a/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java b/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java index aafce4f..698d38a 100644 --- a/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java +++ b/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java @@ -9,7 +9,7 @@ import java.util.List; /** * Synchronized set wrapper for the LeastRecentlyUsedMap. - * + * * This code is heavily based on the HashSet code that represent Map as a Set. * Unfortunately HashSet does not allow to use a custom Map as its Storage. * Therefore overriding removeEldestEntry() is impossible for a normal LinkedHashSet. @@ -50,7 +50,7 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E> /** * Synchronized access to set size * Copy of the HashSet code if size() - * + * * @see HashSet */ @Override @@ -61,7 +61,7 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E> /** * Synchronized check of set emptiness * Copy of the HashSet code if isEmpty() - * + * * @see HashSet */ @Override @@ -72,7 +72,7 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E> /** * Synchronized check for containment * Copy of the HashSet code if contains() - * + * * @see HashSet */ @Override @@ -83,18 +83,21 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E> /** * Synchronized addition of an item * Copy of the HashSet code if add() - * + * * @see HashSet */ @Override public synchronized boolean add(E e) { + if (e == null) { + throw new IllegalArgumentException("LeastRecentlyUsedSet cannot take null element"); + } return map.put(e, PRESENT) == null; } /** * Synchronized removal of a contained item * Copy of the HashSet code if remove() - * + * * @see HashSet */ @Override @@ -117,7 +120,7 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E> /** * Synchronized clearing of the set * Copy of the HashSet code if clear() - * + * * @see HashSet */ @Override @@ -128,7 +131,7 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E> /** * (synchronized) Clone of the set * Copy of the HashSet code if clone() - * + * * @see HashSet */ @Override |
