Ignore:
Timestamp:
2016-07-17T12:40:18+02:00 (8 years ago)
Author:
wiktorn
Message:

Use stale cache tiles if IOException occurs

  • small pretty print fixes (MemoryTileCache, TileSet)
  • increase TileCache estimate (to accomodate larger TileSet's traverses when in offline mode)
  • fix TileSet computations, sometimes it generated tileset of size 2 instead of 4 (for tiles inside the tile)

Closes: #13128

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java

    r10469 r10545  
    387387        } catch (IOException e) {
    388388            log.log(Level.FINE, "JCS - IOExecption during communication with server for: {0}", getUrlNoException());
    389             attributes.setError(e);
    390             attributes.setResponseCode(499); // set dummy error code
    391             boolean doCache = isResponseLoadable(null, 499, null) || cacheAsEmpty(); //generic 499 error code returned
    392             if (doCache) {
    393                 cacheData = createCacheEntry(new byte[]{});
    394                 cache.put(getCacheKey(), createCacheEntry(new byte[]{}), attributes);
    395             }
    396             return doCache;
     389            if (isObjectLoadable()) {
     390                return true;
     391            } else {
     392                attributes.setError(e);
     393                attributes.setResponseCode(499); // set dummy error code
     394                boolean doCache = isResponseLoadable(null, 499, null) || cacheAsEmpty(); //generic 499 error code returned
     395                if (doCache) {
     396                    cacheData = createCacheEntry(new byte[]{});
     397                    cache.put(getCacheKey(), createCacheEntry(new byte[]{}), attributes);
     398                }
     399                return doCache;
     400            }
     401
    397402        } catch (InterruptedException e) {
    398403            attributes.setError(e);
Note: See TracChangeset for help on using the changeset viewer.