Index: /trunk/src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java	(revision 19661)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java	(revision 19662)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.gui.preferences.server;
 
+import static org.openstreetmap.josm.tools.I18n.marktr;
 import static org.openstreetmap.josm.tools.I18n.tr;
 
@@ -8,4 +9,5 @@
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
+import java.net.URI;
 import java.net.URL;
 
@@ -38,4 +40,6 @@
     private final Component parent;
     private HttpClient connection;
+
+    private static final String CONNECTION_FAILED_MSG = marktr("Connection to API failed");
 
     /**
@@ -94,5 +98,5 @@
                         url
                 ),
-                tr("Connection to API failed"),
+                tr(CONNECTION_FAILED_MSG),
                 JOptionPane.ERROR_MESSAGE,
                 HelpUtil.ht("/Preferences/Connection#ConnectionToAPIFailed")
@@ -111,5 +115,5 @@
                         url
                 ),
-                tr("Connection to API failed"),
+                tr(CONNECTION_FAILED_MSG),
                 JOptionPane.ERROR_MESSAGE,
                 HelpUtil.ht("/Preferences/Connection#InvalidServerResult")
@@ -127,5 +131,5 @@
                         url
                 ),
-                tr("Connection to API failed"),
+                tr(CONNECTION_FAILED_MSG),
                 JOptionPane.ERROR_MESSAGE,
                 HelpUtil.ht("/Preferences/Connection#InvalidSettings")
@@ -152,14 +156,14 @@
         try {
             try {
-                new URL(url);
-            } catch (MalformedURLException e) {
+                URI.create(url).toURL();
+            } catch (IllegalArgumentException | MalformedURLException e) {
                 alertInvalidUrl(url);
                 return;
             }
-            URL capabilitiesUrl;
-            String getCapabilitiesUrl = url + "/0.6/capabilities";
+            final URL capabilitiesUrl;
+            final String getCapabilitiesUrl = url + "/0.6/capabilities";
             try {
-                capabilitiesUrl = new URL(getCapabilitiesUrl);
-            } catch (MalformedURLException e) {
+                capabilitiesUrl = URI.create(getCapabilitiesUrl).toURL();
+            } catch (IllegalArgumentException | MalformedURLException e) {
                 alertInvalidCapabilitiesUrl(getCapabilitiesUrl);
                 return;
@@ -171,6 +175,7 @@
             }
 
-            if (connection.getResponse().getResponseCode() != HttpURLConnection.HTTP_OK) {
-                alertInvalidServerResult(connection.getResponse().getResponseCode());
+            final int responseCode = connection.getResponse().getResponseCode();
+            if (responseCode  != HttpURLConnection.HTTP_OK) {
+                alertInvalidServerResult(responseCode );
                 return;
             }
@@ -185,7 +190,8 @@
             success = true;
         } catch (IOException e) {
-            if (canceled)
+            if (canceled) {
                 // ignore exceptions
                 return;
+            }
             Logging.error(e);
             alertConnectionFailed();
