Index: /trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java	(revision 16411)
+++ /trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java	(revision 16412)
@@ -56,5 +56,5 @@
     // CHECKSTYLE.OFF: SingleSpaceSeparator
     // WMS 1.0 - 1.3.0
-    private static final QName CAPABILITITES_ROOT_130 = new QName("WMS_Capabilities", WMS_NS_URL);
+    private static final QName CAPABILITIES_ROOT_130  = new QName(WMS_NS_URL, "WMS_Capabilities");
     private static final QName QN_ABSTRACT            = new QName(WMS_NS_URL, "Abstract");
     private static final QName QN_CAPABILITY          = new QName(WMS_NS_URL, "Capability");
@@ -374,5 +374,5 @@
 
     private void attemptGetCapabilities(String url) throws IOException, WMSGetCapabilitiesException {
-        Logging.debug("Trying WMS getcapabilities with url {0}", url);
+        Logging.debug("Trying WMS GetCapabilities with url {0}", url);
         try (CachedFile cf = new CachedFile(url); InputStream in = cf.setHttpHeaders(headers).
                 setMaxAge(7 * CachedFile.DAYS).
@@ -385,12 +385,11 @@
                     if (event == XMLStreamReader.START_ELEMENT) {
                         if (tagEquals(CAPABILITIES_ROOT_111, reader.getName())) {
-                            // version 1.1.1
-                            this.version = reader.getAttributeValue(null, "version");
-                            if (this.version == null) {
-                                this.version = "1.1.1";
-                            }
+                            this.version = Utils.firstNotEmptyString("1.1.1",
+                                    reader.getAttributeValue(null, "version"));
                         }
-                        if (tagEquals(CAPABILITITES_ROOT_130, reader.getName())) {
-                            this.version = reader.getAttributeValue(WMS_NS_URL, "version");
+                        if (tagEquals(CAPABILITIES_ROOT_130, reader.getName())) {
+                            this.version = Utils.firstNotEmptyString("1.3.0",
+                                    reader.getAttributeValue(WMS_NS_URL, "version"),
+                                    reader.getAttributeValue(null, "version"));
                         }
                         if (tagEquals(QN_SERVICE, reader.getName())) {
Index: /trunk/test/data/regress/19193/capabilities.xml
===================================================================
--- /trunk/test/data/regress/19193/capabilities.xml	(revision 16412)
+++ /trunk/test/data/regress/19193/capabilities.xml	(revision 16412)
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="utf-8"?>
+<WMS_Capabilities version="1.3.0" xmlns="http://www.opengis.net/wms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sld="http://www.opengis.net/sld" xmlns:inspire_common="http://inspire.ec.europa.eu/schemas/common/1.0" xmlns:inspire_vs="http://inspire.ec.europa.eu/schemas/inspire_vs/1.0" xsi:schemaLocation="http://www.opengis.net/wms https://isk.geobasis-bb.de/schema/ogc/wms/1.3.0/capabilities_1_3_0.xsd http://inspire.ec.europa.eu/schemas/inspire_vs/1.0 https://isk.geobasis-bb.de/schema/inspire/inspire_vs/1.0/inspire_vs.xsd" updateSequence="2016-01-01">
+	<Service>
+		<Name>WMS</Name>
+		<Title>INSPIRE-WMS BB Geografische Bezeichnungen ALKIS</Title>
+		<Abstract>Dieser Dienst stellt für das INSPIRE-Thema Geografische Bezeichnungen aus ALKIS umgesetzte Daten bereit.</Abstract>
+		<KeywordList>
+			<Keyword>opendata</Keyword>
+			<Keyword>Geobasisdaten</Keyword>
+			<Keyword>AdV</Keyword>
+			<Keyword>WMS</Keyword>
+			<Keyword>AdV-OWS-Basisprofil</Keyword>
+			<Keyword>AdV-WMS-Profil 4.0.0</Keyword>
+			<Keyword>AdV-INSPIRE-Produktspezifikation (Version 1.0.0)</Keyword>
+			<Keyword>BB</Keyword>
+			<Keyword>Brandenburg</Keyword>
+			<Keyword>inspireidentifiziert</Keyword>
+			<Keyword>infoMapAccessService</Keyword>
+			<Keyword>INSPIRE-WMS_BB_Geografische_Bezeichnungen_ALKIS</Keyword>
+			<Keyword>ALKIS</Keyword>
+			<Keyword>Amtliches Liegenschaftskatasterinformationssystem</Keyword>
+			<Keyword>Geografische Bezeichnungen</Keyword>
+			<Keyword>Geographical Names</Keyword>
+		</KeywordList>
+		<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://geobroker.geobasis-bb.de/gbss.php?MODE=GetProductPreview&amp;PRODUCTID="/>
+		<ContactInformation>
+			<ContactPersonPrimary>
+				<ContactPerson>Kundenservice</ContactPerson>
+				<ContactOrganization>Landesvermessung und Geobasisinformation Brandenburg (LGB)</ContactOrganization>
+			</ContactPersonPrimary>
+			<ContactAddress>
+				<AddressType>postalisch</AddressType>
+				<Address>Heinrich-Mann-Allee 103</Address>
+				<City>Potsdam</City>
+				<StateOrProvince>Brandenburg</StateOrProvince>
+				<PostCode>14473</PostCode>
+				<Country>DE</Country>
+			</ContactAddress>
+			<ContactVoiceTelephone>+49-331-8844-123</ContactVoiceTelephone>
+			<ContactFacsimileTelephone>+49-331-8844-16123</ContactFacsimileTelephone>
+			<ContactElectronicMailAddress>kundenservice@geobasis-bb.de</ContactElectronicMailAddress>
+		</ContactInformation>
+		<Fees>kostenfrei, unter Beachtung der Lizenzbedingungen</Fees>
+		<AccessConstraints>Nutzungsbedingungen: Datenlizenz Deutschland - Namensnennung - Version 2.0, https://www.govdata.de/dl-de/by-2-0; dl-de-by-2.0, Namensnennung: "GeoBasis-DE/LGB", Beispiel: „© GeoBasis-DE/LGB, dl-de/by-2-0, (Daten geändert)“, (Klammer = optional)</AccessConstraints>
+		<MaxWidth>8000</MaxWidth>
+		<MaxHeight>8000</MaxHeight>
+	</Service>
+	<Capability>
+		<Request>
+			<GetCapabilities>
+				<Format>text/xml</Format>
+				<DCPType>
+					<HTTP>
+						<Get>
+							<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://inspire.brandenburg.de/services/gn_alkis_wms?"/>
+						</Get>
+					</HTTP>
+				</DCPType>
+			</GetCapabilities>
+			<GetMap>
+				<Format>image/png</Format>
+				<Format>image/jpeg</Format>
+				<Format>image/gif</Format>
+				<DCPType>
+					<HTTP>
+						<Get>
+							<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://inspire.brandenburg.de/services/gn_alkis_wms?"/>
+						</Get>
+						<Post>
+							<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://inspire.brandenburg.de/services/gn_alkis_wms"/>
+						</Post>
+					</HTTP>
+				</DCPType>
+			</GetMap>
+			<GetFeatureInfo>
+				<Format>text/xml;subtype=gml/3.2.1</Format>
+				<Format>text/html</Format>
+				<DCPType>
+					<HTTP>
+						<Get>
+							<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://inspire.brandenburg.de/services/gn_alkis_wms?"/>
+						</Get>
+					</HTTP>
+				</DCPType>
+			</GetFeatureInfo>
+		</Request>
+		<Exception>
+			<Format>XML</Format>
+			<Format>INIMAGE</Format>
+			<Format>BLANK</Format>
+		</Exception>
+		<inspire_vs:ExtendedCapabilities>
+			<inspire_common:MetadataUrl>
+				<inspire_common:URL>https://isk.geobasis-bb.de/geomis-csw/service?REQUEST=GetRecordById&amp;service=CSW&amp;version=2.0.2&amp;resultType=results&amp;typeNames=csw:Record&amp;elementSetName=full&amp;ID=7347fb33-4a38-4f1c-a133-46c60cbd793b</inspire_common:URL>
+				<inspire_common:MediaType>application/vnd.ogc.csw.GetRecordByIdResponse_xml</inspire_common:MediaType>
+			</inspire_common:MetadataUrl>
+			<inspire_common:SupportedLanguages>
+				<inspire_common:DefaultLanguage>
+					<inspire_common:Language>ger</inspire_common:Language>
+				</inspire_common:DefaultLanguage>
+			</inspire_common:SupportedLanguages>
+			<inspire_common:ResponseLanguage>
+				<inspire_common:Language>ger</inspire_common:Language>
+			</inspire_common:ResponseLanguage>
+		</inspire_vs:ExtendedCapabilities>
+		<Layer queryable="0">
+			<Title>INSPIRE GN ALKIS BB</Title>
+			<Abstract>INSPIRE Geografische Bezeichnungen aus ALKIS in BB</Abstract>
+			<CRS>EPSG:25833</CRS>
+			<CRS>EPSG:25832</CRS>
+			<CRS>EPSG:4326</CRS>
+			<CRS>EPSG:4258</CRS>
+			<CRS>EPSG:3034</CRS>
+			<CRS>EPSG:3035</CRS>
+			<CRS>EPSG:3044</CRS>
+			<CRS>EPSG:3045</CRS>
+			<CRS>EPSG:3857</CRS>
+			<CRS>EPSG:4839</CRS>
+			<CRS>EPSG:5650</CRS>
+			<CRS>EPSG:4647</CRS>
+			<CRS>urn:adv:crs:ETRS89_UTM33</CRS>
+			<CRS>urn:adv:crs:ETRS89_UTM32</CRS>
+			<CRS>urn:adv:crs:WGS84_Lat-Lon</CRS>
+			<CRS>urn:adv:crs:ETRS89_Lat-Lon</CRS>
+			<CRS>urn:adv:crs:ETRS89_LCC</CRS>
+			<CRS>urn:adv:crs:ETRS89_LAEA</CRS>
+			<CRS>urn:adv:crs:ETRS89_UTM32_N-E</CRS>
+			<CRS>urn:adv:crs:ETRS89_UTM33_N-E</CRS>
+			<CRS>urn:adv:crs:WGS84_Pseudo-Mercator</CRS>
+			<CRS>urn:adv:crs:ETRS89_LCC_N-E</CRS>
+			<CRS>urn:adv:crs:ETRS89_UTM33_zE-N</CRS>
+			<CRS>urn:adv:crs:ETRS89_UTM32_zE-N</CRS>
+			<EX_GeographicBoundingBox>
+				<westBoundLongitude>10.8978490830899</westBoundLongitude>
+				<eastBoundLongitude>14.9049379960258</eastBoundLongitude>
+				<southBoundLatitude>51.2999957016739</southBoundLatitude>
+				<northBoundLatitude>53.5999945122912</northBoundLatitude>
+			</EX_GeographicBoundingBox>
+			<BoundingBox CRS="EPSG:25833" minx="228152" miny="5690412" maxx="493382" maxy="5939023" resx="1" resy="1"/>
+			<BoundingBox CRS="EPSG:25832" minx="625794.536741298" miny="5685280.5860994" maxx="910927.519457639" maxy="5955214.83895806" resx="1" resy="1"/>
+			<BoundingBox CRS="EPSG:4326" minx="51.2999957016739" miny="11.0999882741047" maxx="53.5999945122912" maxy="14.8999944420867" resx="1" resy="1"/>
+			<BoundingBox CRS="EPSG:4258" minx="51.2999957016739" miny="11.0999882741047" maxx="53.5999945122912" maxy="14.8999944420867" resx="1" resy="1"/>
+			<BoundingBox CRS="EPSG:3034" minx="2725337.83351404" miny="4074079.90884607" maxx="2982432.33771219" maxy="4313382.25302754" resx="1" resy="1"/>
+			<BoundingBox CRS="EPSG:3035" minx="3132694.44665344" miny="4397714.6851617" maxx="3399003.9057543" maxy="4645148.41163017" resx="1" resy="1"/>
+			<BoundingBox CRS="EPSG:3044" minx="5685280.5860994" miny="646395.940082372" maxx="5955214.83895806" maxy="890235.390177993" resx="1" resy="1"/>
+			<BoundingBox CRS="EPSG:3045" minx="5690411.99996247" miny="228151.999999013" maxx="5939023" maxy="493382" resx="1" resy="1"/>
+			<BoundingBox CRS="EPSG:3857" minx="1213143.01067151" miny="6674532.03302645" maxx="1659210.10802291" maxy="7094761.09393721" resx="1" resy="1"/>
+			<BoundingBox CRS="EPSG:4839" minx="33513.7841376633" miny="41805.4793396569" maxx="297826.875537171" maxy="291103.368749009" resx="1" resy="1"/>
+			<BoundingBox CRS="EPSG:5650" minx="33228151.999999" miny="5690411.99996247" maxx="33493382" maxy="5939023" resx="1" resy="1"/>
+			<BoundingBox CRS="EPSG:4647" minx="32625794.5367413" miny="5685280.5860994" maxx="32910927.5194576" maxy="5955214.83895806" resx="1" resy="1"/>
+			<BoundingBox CRS="urn:adv:crs:ETRS89_UTM33" minx="228152" miny="5690412" maxx="493382" maxy="5939023" resx="1" resy="1"/>
+			<BoundingBox CRS="urn:adv:crs:ETRS89_UTM32" minx="625794.536741298" miny="5685280.5860994" maxx="910927.519457639" maxy="5955214.83895806" resx="1" resy="1"/>
+			<BoundingBox CRS="urn:adv:crs:WGS84_Lat-Lon" minx="51.2999957016739" miny="11.0999882741047" maxx="53.5999945122912" maxy="14.8999944420867" resx="1" resy="1"/>
+			<BoundingBox CRS="urn:adv:crs:ETRS89_Lat-Lon" minx="51.2999957016739" miny="11.0999882741047" maxx="53.5999945122912" maxy="14.8999944420867" resx="1" resy="1"/>
+			<BoundingBox CRS="urn:adv:crs:ETRS89_LCC" minx="2725337.83351404" miny="4074079.90884607" maxx="2982432.33771219" maxy="4313382.25302754" resx="1" resy="1"/>
+			<BoundingBox CRS="urn:adv:crs:ETRS89_LAEA" minx="3132694.44665344" miny="4397714.6851617" maxx="3399003.9057543" maxy="4645148.41163017" resx="1" resy="1"/>
+			<BoundingBox CRS="urn:adv:crs:ETRS89_UTM32_N-E" minx="5685280.5860994" miny="646395.940082372" maxx="5955214.83895806" maxy="890235.390177993" resx="1" resy="1"/>
+			<BoundingBox CRS="urn:adv:crs:ETRS89_UTM33_N-E" minx="5690411.99996247" miny="228151.999999013" maxx="5939023" maxy="493382" resx="1" resy="1"/>
+			<BoundingBox CRS="urn:adv:crs:WGS84_Pseudo-Mercator" minx="1213143.01067151" miny="6674532.03302645" maxx="1659210.10802291" maxy="7094761.09393721" resx="1" resy="1"/>
+			<BoundingBox CRS="urn:adv:crs:ETRS89_LCC_N-E" minx="33513.7841376633" miny="41805.4793396569" maxx="297826.875537171" maxy="291103.368749009" resx="1" resy="1"/>
+			<BoundingBox CRS="urn:adv:crs:ETRS89_UTM33_zE-N" minx="33228151.999999" miny="5690411.99996247" maxx="33493382" maxy="5939023" resx="1" resy="1"/>
+			<BoundingBox CRS="urn:adv:crs:ETRS89_UTM32_zE-N" minx="32625794.5367413" miny="5685280.5860994" maxx="32910927.5194576" maxy="5955214.83895806" resx="1" resy="1"/>
+			<Layer queryable="1">
+				<Name>GN.GeographicalNames</Name>
+				<Title>Geografische Bezeichnungen</Title>
+				<Abstract>Geografische Bezeichnungen</Abstract>
+				<KeywordList>
+					<Keyword>Benannter Ort</Keyword>
+					<Keyword>Named Place</Keyword>
+					<Keyword>endonym</Keyword>
+					<Keyword>exonym</Keyword>
+					<Keyword>feature name</Keyword>
+					<Keyword>geographical name</Keyword>
+					<Keyword>location name</Keyword>
+					<Keyword>name</Keyword>
+					<Keyword>place name</Keyword>
+					<Keyword>spatial object name</Keyword>
+					<Keyword>toponym</Keyword>
+					<Keyword>toponymy</Keyword>
+				</KeywordList>
+				<AuthorityURL name="lgb">
+					<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://geoportal.brandenburg.de/registry/lgb"/>
+				</AuthorityURL>
+				<MetadataURL type="ISO19115:2003">
+					<Format>text/xml</Format>
+					<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://isk.geobasis-bb.de/geomis-csw/service?REQUEST=GetRecordById&amp;service=CSW&amp;version=2.0.2&amp;resultType=results&amp;typeNames=csw:Record&amp;elementSetName=full&amp;ID=7111bcbc-6d35-49fd-8928-1ba9efc0243a"/>
+				</MetadataURL>
+				<Style>
+					<Name>GN.GeographicalNames.Default</Name>
+					<Title>GN.GeographicalNames.Default</Title>
+					<Abstract>GN.GeographicalNames.Default</Abstract>
+					<LegendURL width="184" height="27">
+						<Format>image/png</Format>
+						<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="https://isk.geobasis-bb.de/legends/GN.GeographicalNames.Default.png"/>
+					</LegendURL>
+				</Style>
+				<MinScaleDenominator>1</MinScaleDenominator>
+				<MaxScaleDenominator>20000</MaxScaleDenominator>
+			</Layer>
+		</Layer>
+	</Capability>
+</WMS_Capabilities>
Index: /trunk/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java	(revision 16411)
+++ /trunk/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java	(revision 16412)
@@ -3,4 +3,5 @@
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
@@ -84,15 +85,30 @@
     @Test
     public void testTicket16248() throws IOException, WMSGetCapabilitiesException {
-        tileServer.stubFor(
-                WireMock.get(WireMock.anyUrl())
-                .willReturn(WireMock.aResponse().withBody(
-                        Files.readAllBytes(Paths.get(TestUtils.getRegressionDataFile(16248, "capabilities.xml")))
-                        ))
-                );
+        byte[] capabilities = Files.readAllBytes(Paths.get(TestUtils.getRegressionDataFile(16248, "capabilities.xml")));
+        tileServer.stubFor(WireMock.get(WireMock.anyUrl()).willReturn(WireMock.aResponse().withBody(capabilities)));
         WMSImagery wms = new WMSImagery(tileServer.url("any"));
         assertEquals("http://wms.hgis.cartomatic.pl/topo/3857/m25k?", wms.buildRootUrl());
         assertEquals("wms.hgis.cartomatic.pl", wms.getLayers().get(0).getName());
-        assertEquals("http://wms.hgis.cartomatic.pl/topo/3857/m25k?FORMAT=image/png&TRANSPARENT=TRUE&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&"
-                + "LAYERS=wms.hgis.cartomatic.pl&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}",
+        assertEquals("http://wms.hgis.cartomatic.pl/topo/3857/m25k?FORMAT=image/png&TRANSPARENT=TRUE&VERSION=1.3.0&SERVICE=WMS&REQUEST=GetMap&"
+                + "LAYERS=wms.hgis.cartomatic.pl&STYLES=&CRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}",
+                wms.buildGetMapUrl(wms.getLayers(), (List<String>) null, true));
+    }
+
+    /**
+     * Non-regression test for bug #19193.
+     * @throws IOException if any I/O error occurs
+     * @throws WMSGetCapabilitiesException never
+     */
+    @Test
+    public void testTicket19193() throws IOException, WMSGetCapabilitiesException {
+        byte[] capabilities = Files.readAllBytes(Paths.get(TestUtils.getRegressionDataFile(19193, "capabilities.xml")));
+        tileServer.stubFor(WireMock.get(WireMock.anyUrl()).willReturn(WireMock.aResponse().withBody(capabilities)));
+        WMSImagery wms = new WMSImagery(tileServer.url("any"));
+        assertEquals("https://inspire.brandenburg.de/services/gn_alkis_wms?", wms.buildRootUrl());
+        assertEquals(1, wms.getLayers().size());
+        assertNull(wms.getLayers().get(0).getName());
+        assertEquals("INSPIRE GN ALKIS BB", wms.getLayers().get(0).getTitle());
+        assertEquals("https://inspire.brandenburg.de/services/gn_alkis_wms?FORMAT=image/png&TRANSPARENT=TRUE&VERSION=1.3.0&"
+                + "SERVICE=WMS&REQUEST=GetMap&LAYERS=null&STYLES=&CRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}",
                 wms.buildGetMapUrl(wms.getLayers(), (List<String>) null, true));
     }
