diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2011-10-27 08:50:30 +0200 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2011-10-27 08:50:30 +0200 |
commit | 863ebe9d98f0159fd542cbd8d5cffce0c047e45b (patch) | |
tree | 35952c960bda97b8ad420ce459582c49200d65c5 /main/src/cgeo | |
parent | bc87d9c3df4d753566bb78205e440b0256c9a550 (diff) | |
download | cgeo-863ebe9d98f0159fd542cbd8d5cffce0c047e45b.zip cgeo-863ebe9d98f0159fd542cbd8d5cffce0c047e45b.tar.gz cgeo-863ebe9d98f0159fd542cbd8d5cffce0c047e45b.tar.bz2 |
Push isBlank test upper, as in many cases it cannot be blank
Diffstat (limited to 'main/src/cgeo')
-rw-r--r-- | main/src/cgeo/geocaching/cgeoapplication.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/main/src/cgeo/geocaching/cgeoapplication.java b/main/src/cgeo/geocaching/cgeoapplication.java index f876552..1573b3f 100644 --- a/main/src/cgeo/geocaching/cgeoapplication.java +++ b/main/src/cgeo/geocaching/cgeoapplication.java @@ -299,23 +299,22 @@ public class cgeoapplication extends Application { } public cgCache getCacheByGeocode(String geocode) { - return getCacheByGeocode(geocode, false, true, false, false, false, false); - } - - public cgCache getCacheByGeocode(String geocode, boolean loadAttributes, boolean loadWaypoints, boolean loadSpoilers, boolean loadLogs, boolean loadInventory, boolean loadOfflineLog) { if (StringUtils.isBlank(geocode)) { return null; } - cgCache cache = null; + return getCacheByGeocode(geocode, false, true, false, false, false, false); + } + + public cgCache getCacheByGeocode(final String geocode, final boolean loadAttributes, final boolean loadWaypoints, final boolean loadSpoilers, final boolean loadLogs, final boolean loadInventory, final boolean loadOfflineLog) { if (cachesCache.containsKey(geocode)) { - cache = cachesCache.get(geocode); - } else { - cache = getStorage().loadCache(geocode, null, loadAttributes, loadWaypoints, loadSpoilers, loadLogs, loadInventory, loadOfflineLog); + return cachesCache.get(geocode); + } - if (cache != null && cache.detailed && loadAttributes && loadWaypoints && loadSpoilers && loadLogs && loadInventory) { - putCacheInCache(cache); - } + final cgCache cache = getStorage().loadCache(geocode, null, loadAttributes, loadWaypoints, loadSpoilers, loadLogs, loadInventory, loadOfflineLog); + + if (cache != null && cache.detailed && loadAttributes && loadWaypoints && loadSpoilers && loadLogs && loadInventory) { + putCacheInCache(cache); } return cache; |