Ignore:
Timestamp:
2018-04-16T23:00:30+02:00 (6 years ago)
Author:
wiktorn
Message:

In case of any IOExceptions when creating disk cache return memory-only cache

Closes: #16193

Location:
trunk/src/org/openstreetmap/josm/gui/layer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/AbstractCachedTileSourceLayer.java

    r12620 r13643  
    22package org.openstreetmap.josm.gui.layer;
    33
    4 import java.io.IOException;
    54import java.util.Map;
    65import java.util.concurrent.ConcurrentHashMap;
     
    1615import org.openstreetmap.josm.data.imagery.TileLoaderFactory;
    1716import org.openstreetmap.josm.data.preferences.IntegerProperty;
    18 import org.openstreetmap.josm.tools.Logging;
    1917
    2018/**
     
    8482            return cache;
    8583        }
    86         try {
    87             cache = JCSCacheManager.getCache(getCacheName(),
    88                     0,
    89                     getDiskCacheSize(),
    90                     CachedTileLoaderFactory.PROP_TILECACHE_DIR.get());
    91             return cache;
    92         } catch (IOException e) {
    93             Logging.warn(e);
    94             return null;
    95         }
     84        cache = JCSCacheManager.getCache(getCacheName(),
     85                0,
     86                getDiskCacheSize(),
     87                CachedTileLoaderFactory.PROP_TILECACHE_DIR.get());
     88        return cache;
    9689    }
    9790
     
    125118     */
    126119    public static CacheAccess<String, BufferedImageCacheEntry> getCache(String name) {
    127             try {
    128                 return JCSCacheManager.getCache(name,
    129                         0,
    130                         MAX_DISK_CACHE_SIZE.get() * 1024, // MAX_DISK_CACHE_SIZE is in MB, needs to by in sync with getDiskCacheSize
    131                         CachedTileLoaderFactory.PROP_TILECACHE_DIR.get());
    132             } catch (IOException e) {
    133                 Logging.warn(e);
    134                 return null;
    135             }
     120            return JCSCacheManager.getCache(name,
     121                    0,
     122                    MAX_DISK_CACHE_SIZE.get() * 1024, // MAX_DISK_CACHE_SIZE is in MB, needs to by in sync with getDiskCacheSize
     123                    CachedTileLoaderFactory.PROP_TILECACHE_DIR.get());
    136124    }
    137125
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoader.java

    r13127 r13643  
    6868    private void initCache() {
    6969        if (!cacheOff) {
    70             try {
    71                 cache = JCSCacheManager.getCache("geoimage-thumbnails", 0, 120,
    72                         Config.getDirs().getCacheDirectory(true).getPath() + File.separator + "geoimage-thumbnails");
    73             } catch (IOException e) {
    74                 Logging.warn("Failed to initialize cache for geoimage-thumbnails");
    75                 Logging.warn(e);
    76             }
     70            cache = JCSCacheManager.getCache("geoimage-thumbnails", 0, 120,
     71                    Config.getDirs().getCacheDirectory(true).getPath() + File.separator + "geoimage-thumbnails");
    7772        }
    7873    }
Note: See TracChangeset for help on using the changeset viewer.