Changeset 13228 in josm


Ignore:
Timestamp:
2017-12-21T15:36:03+01:00 (7 years ago)
Author:
Don-vip
Message:

WMS robustness

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java

    r13203 r13228  
    221221                getCapabilitiesUrl = new URL(serviceUrlStr);
    222222            }
    223             serviceUrl = new URL(serviceUrlStr);
     223            // Make sure we don't keep GetCapabilities request in service URL
     224            serviceUrl = new URL(serviceUrlStr.replace("REQUEST=GetCapabilities", "").replace("&&", "&"));
    224225        } catch (HeadlessException e) {
    225226            Logging.warn(e);
     
    267268                String baseURL = child.getAttribute("xlink:href");
    268269                if (!baseURL.equals(serviceUrlStr)) {
    269                     Logging.info("GetCapabilities specifies a different service URL: " + baseURL);
    270                     serviceUrl = new URL(baseURL);
     270                    URL newURL = new URL(baseURL);
     271                    if (newURL.getAuthority() != null) {
     272                        Logging.info("GetCapabilities specifies a different service URL: " + baseURL);
     273                        serviceUrl = newURL;
     274                    }
    271275                }
    272276            }
Note: See TracChangeset for help on using the changeset viewer.