Index: /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/AddWMSLayerPanel.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/AddWMSLayerPanel.java	(revision 22941)
+++ /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/AddWMSLayerPanel.java	(revision 22942)
@@ -214,15 +214,11 @@
         serviceUrl = null;
         try {
-            if (serviceUrlStr.endsWith("?")) {
-                // It's the root of the URL. We need to append the GetCapabilities
-                // query parameters
+            if (!serviceUrlStr.trim().contains("capabilities")) {
+                // If the url doesn't already have GetCapabilities, add it in
                 serviceUrl = new URL(serviceUrlStr + "VERSION=1.1.1&SERVICE=WMS&REQUEST=GetCapabilities");
-            } else if (serviceUrlStr.toLowerCase().contains("getcapabilities")) {
-                // The URL already contains the GetCapabilities query parameters
+            } else {
+                // Otherwise assume it's a good URL and let the subsequent error
+                // handling systems deal with problems
                 serviceUrl = new URL(serviceUrlStr);
-            } else {
-                JOptionPane.showMessageDialog(this, tr("Invalid service URL."),
-                        tr("WMS Error"), JOptionPane.ERROR_MESSAGE);
-                return;
             }
         } catch (HeadlessException e) {
@@ -233,4 +229,6 @@
             return;
         }
+
+        System.out.println("Connecting to: " + serviceUrl);
 
         String incomingData;
@@ -252,4 +250,6 @@
         }
 
+        System.out.println(incomingData);
+
         Document document;
         try {
@@ -272,10 +272,16 @@
         }
 
-        treeRootNode.setUserObject(serviceUrl.getHost());
-        Element capabilityElem = getChild(document.getDocumentElement(), "Capability");
-        List<Element> children = getChildren(capabilityElem, "Layer");
-        List<LayerDetails> layers = parseLayers(children, new HashSet<String>());
-
-        updateTreeList(layers);
+        try {
+            treeRootNode.setUserObject(serviceUrl.getHost());
+            Element capabilityElem = getChild(document.getDocumentElement(), "Capability");
+            List<Element> children = getChildren(capabilityElem, "Layer");
+            List<LayerDetails> layers = parseLayers(children, new HashSet<String>());
+            updateTreeList(layers);
+        } catch(Exception e) {
+            JOptionPane.showMessageDialog(this, tr("Could not parse WMS layer list."),
+                    tr("WMS Error"), JOptionPane.ERROR_MESSAGE);
+            e.printStackTrace();
+            return;
+        }
     }
 
@@ -358,7 +364,11 @@
         for (Projection proj : Projection.allProjections) {
             if (proj instanceof ProjectionSubPrefs) {
-                return ((ProjectionSubPrefs) proj).getPreferencesFromCode(crs) == null;
+                if (((ProjectionSubPrefs) proj).getPreferencesFromCode(crs) == null) {
+                    return true;
+                }
             } else {
-                return proj.toCode().equals(crs);
+                if (proj.toCode().equals(crs)) {
+                    return true;
+                }
             }
         }
