Changeset 16412 in josm for trunk/src/org


Ignore:
Timestamp:
2020-05-15T20:17:24+02:00 (4 years ago)
Author:
simon04
Message:

fix #19193 - WMSImagery: fix parsing of version 1.3.0 capabilities

For the constant CAPABILITIES_ROOT_130, the namespaceURI and localPart were interchanged.

File:
1 edited

Legend:

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

    r15716 r16412  
    5656    // CHECKSTYLE.OFF: SingleSpaceSeparator
    5757    // WMS 1.0 - 1.3.0
    58     private static final QName CAPABILITITES_ROOT_130 = new QName("WMS_Capabilities", WMS_NS_URL);
     58    private static final QName CAPABILITIES_ROOT_130  = new QName(WMS_NS_URL, "WMS_Capabilities");
    5959    private static final QName QN_ABSTRACT            = new QName(WMS_NS_URL, "Abstract");
    6060    private static final QName QN_CAPABILITY          = new QName(WMS_NS_URL, "Capability");
     
    374374
    375375    private void attemptGetCapabilities(String url) throws IOException, WMSGetCapabilitiesException {
    376         Logging.debug("Trying WMS getcapabilities with url {0}", url);
     376        Logging.debug("Trying WMS GetCapabilities with url {0}", url);
    377377        try (CachedFile cf = new CachedFile(url); InputStream in = cf.setHttpHeaders(headers).
    378378                setMaxAge(7 * CachedFile.DAYS).
     
    385385                    if (event == XMLStreamReader.START_ELEMENT) {
    386386                        if (tagEquals(CAPABILITIES_ROOT_111, reader.getName())) {
    387                             // version 1.1.1
    388                             this.version = reader.getAttributeValue(null, "version");
    389                             if (this.version == null) {
    390                                 this.version = "1.1.1";
    391                             }
     387                            this.version = Utils.firstNotEmptyString("1.1.1",
     388                                    reader.getAttributeValue(null, "version"));
    392389                        }
    393                         if (tagEquals(CAPABILITITES_ROOT_130, reader.getName())) {
    394                             this.version = reader.getAttributeValue(WMS_NS_URL, "version");
     390                        if (tagEquals(CAPABILITIES_ROOT_130, reader.getName())) {
     391                            this.version = Utils.firstNotEmptyString("1.3.0",
     392                                    reader.getAttributeValue(WMS_NS_URL, "version"),
     393                                    reader.getAttributeValue(null, "version"));
    395394                        }
    396395                        if (tagEquals(QN_SERVICE, reader.getName())) {
Note: See TracChangeset for help on using the changeset viewer.