Ignore:
Timestamp:
2020-05-16T20:59:34+02:00 (4 years ago)
Author:
simon04
Message:

see #18712 - Add NetworkManager.isOffline(String) to test offline status of given URL

Deprecates OnlineResource.checkOfflineAccess(String, String)

Location:
trunk/src/org/openstreetmap/josm/data/imagery
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/CachedAttributionBingAerialTileSource.java

    r14746 r16426  
    1515import org.openstreetmap.josm.gui.util.GuiHelper;
    1616import org.openstreetmap.josm.io.CacheCustomContent;
    17 import org.openstreetmap.josm.io.OnlineResource;
     17import org.openstreetmap.josm.io.NetworkManager;
    1818import org.openstreetmap.josm.tools.HttpClient;
    1919import org.openstreetmap.josm.tools.Logging;
     
    6363
    6464        @Override
    65         protected void checkOfflineAccess() {
     65        protected boolean isOffline() {
    6666            try {
    67                 String attributionUrl = getAttributionUrl().toExternalForm();
    68                 OnlineResource.ALL.checkOfflineAccess(attributionUrl, attributionUrl);
     67                return NetworkManager.isOffline(getAttributionUrl().toExternalForm());
    6968            } catch (MalformedURLException e) {
    7069                Logging.error(e);
     70                return false;
    7171            }
    7272        }
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java

    r14214 r16426  
    2222import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    2323import org.openstreetmap.josm.io.CachedFile;
    24 import org.openstreetmap.josm.io.OfflineAccessException;
    25 import org.openstreetmap.josm.io.OnlineResource;
     24import org.openstreetmap.josm.io.NetworkManager;
    2625import org.openstreetmap.josm.io.imagery.ImageryReader;
    2726import org.openstreetmap.josm.spi.preferences.Config;
     
    159158
    160159        protected void loadSource(String source) {
    161             boolean online = true;
    162             try {
    163                 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(source, Config.getUrls().getJOSMWebsite());
    164             } catch (OfflineAccessException e) {
    165                 Logging.log(Logging.LEVEL_WARN, e);
    166                 online = false;
    167             }
     160            boolean online = !NetworkManager.isOffline(source);
    168161            if (clearCache && online) {
    169162                CachedFile.cleanup(source);
Note: See TracChangeset for help on using the changeset viewer.