aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler <bananeweizen@gmx.de>2013-12-26 09:25:13 +0100
committerMichael Keppler <bananeweizen@gmx.de>2013-12-26 09:25:13 +0100
commit00b2ea57510c4df656b63d14535b5fcbcd7efd32 (patch)
treeb71c6440f4cba1ed48a6e1ab0301b90890b2b690
parent52ab8db2429671e30e7cb864e2c03fe5ef790b84 (diff)
downloadcgeo-00b2ea57510c4df656b63d14535b5fcbcd7efd32.zip
cgeo-00b2ea57510c4df656b63d14535b5fcbcd7efd32.tar.gz
cgeo-00b2ea57510c4df656b63d14535b5fcbcd7efd32.tar.bz2
findbugs: synchronize lazy initialized objects
-rw-r--r--main/src/cgeo/geocaching/DataStore.java2
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java5
-rw-r--r--main/src/cgeo/geocaching/settings/Settings.java2
3 files changed, 3 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/DataStore.java b/main/src/cgeo/geocaching/DataStore.java
index 9075d45..c6ee9f2 100644
--- a/main/src/cgeo/geocaching/DataStore.java
+++ b/main/src/cgeo/geocaching/DataStore.java
@@ -304,7 +304,7 @@ public class DataStore {
}
}
- public static void closeDb() {
+ public static synchronized void closeDb() {
if (database == null) {
return;
}
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index 927ff28..d8cad51 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -186,7 +186,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
private boolean markersInvalidated = false; // previous state for loadTimer
private boolean centered = false; // if map is already centered
private boolean alreadyCentered = false; // -""- for setting my location
- private static Set<String> dirtyCaches = null;
+ private static final Set<String> dirtyCaches = new HashSet<String>();
// Thread pooling
private static BlockingQueue<Runnable> displayQueue = new ArrayBlockingQueue<Runnable>(1);
@@ -1605,9 +1605,6 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
public static void markCacheAsDirty(final String geocode) {
- if (dirtyCaches == null) {
- dirtyCaches = new HashSet<String>();
- }
dirtyCaches.add(geocode);
}
diff --git a/main/src/cgeo/geocaching/settings/Settings.java b/main/src/cgeo/geocaching/settings/Settings.java
index 186e5d9..0732866 100644
--- a/main/src/cgeo/geocaching/settings/Settings.java
+++ b/main/src/cgeo/geocaching/settings/Settings.java
@@ -599,7 +599,7 @@ public class Settings {
putInt(R.string.pref_lastmaplon, mapViewCenter.getLongitudeE6());
}
- public static MapSource getMapSource() {
+ public static synchronized MapSource getMapSource() {
if (mapSource != null) {
return mapSource;
}