Index: trunk/src/org/openstreetmap/josm/gui/preferences/AddWMSLayerPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/AddWMSLayerPanel.java	(revision 4466)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/AddWMSLayerPanel.java	(revision 4467)
@@ -307,5 +307,13 @@
             if (!Pattern.compile(".*GetCapabilities.*", Pattern.CASE_INSENSITIVE).matcher(serviceUrlStr).matches()) {
                 // If the url doesn't already have GetCapabilities, add it in
-                getCapabilitiesUrl = new URL(serviceUrlStr + "VERSION=1.1.1&SERVICE=WMS&REQUEST=GetCapabilities");
+                getCapabilitiesUrl = new URL(serviceUrlStr);
+                final String getCapabilitiesQuery = "VERSION=1.1.1&SERVICE=WMS&REQUEST=GetCapabilities";
+                if (getCapabilitiesUrl.getQuery() == null) {
+                    getCapabilitiesUrl = new URL(serviceUrlStr + "?" + getCapabilitiesQuery);
+                } else if (!getCapabilitiesUrl.getQuery().isEmpty() && !getCapabilitiesUrl.getQuery().endsWith("&")) {
+                    getCapabilitiesUrl = new URL(serviceUrlStr + "&" + getCapabilitiesQuery);
+                } else {
+                    getCapabilitiesUrl = new URL(serviceUrlStr + getCapabilitiesQuery);
+                }
             } else {
                 // Otherwise assume it's a good URL and let the subsequent error
