Changeset 19709 in josm for trunk/src


Ignore:
Timestamp:
2026-11-27T15:43:57+01:00 (5 hours ago)
Author:
GerdP
Message:

fix #24893: Cache for background layer Esri World Imagery needs manual flush
patch no-tile-304-v2.patch by wangi

File:
1 edited

Legend:

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

    r19693 r19709  
    367367                // and the server answers with a HTTP 304 = "Not Modified"
    368368                Logging.debug("JCS - If-Modified-Since/ETag test: local version is up to date: {0}", getUrl());
    369                 // update cache attributes
    370                 attributes = parseHeaders(urlConn);
    371                 cache.put(getCacheKey(), cacheData, attributes);
     369                updateAttributes(urlConn);
    372370                return true;
    373371            } else if (isObjectLoadable() // we have an object in cache, but we haven't received 304 response code
    … …  
    559557                (lastModified != 0 && lastModified <= attributes.getLastModification());
    560558        if (ret) {
    561             // update attributes
    562             attributes = parseHeaders(urlConn);
    563             cache.put(getCacheKey(), cacheData, attributes);
     559            updateAttributes(urlConn);
    564560        }
    565561        return ret;
     562    }
     563
     564    /**
     565     * Updates the cache attributes after the server confirmed that the cached object is still valid.
     566     * <p>
     567     * The "no tile at this zoom level" marker is kept: it was found from the response which delivered the object,
     568     * and a confirmation does not repeat that. Without it, an empty no-tile entry would look like a loaded tile
     569     * without an image (see #24893).
     570     * @param urlConn the response which confirmed the cached object
     571     */
     572    private void updateAttributes(HttpClient.Response urlConn) {
     573        final boolean noTileAtZoom = attributes.isNoTileAtZoom();
     574        attributes = parseHeaders(urlConn);
     575        attributes.setNoTileAtZoom(noTileAtZoom);
     576        cache.put(getCacheKey(), cacheData, attributes);
    566577    }
    567578
Note: See TracChangeset for help on using the changeset viewer.