### Eclipse Workspace Patch 1.0
#P josm
diff --git src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java
index 9681092..ab63828 100644
--- src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java
+++ src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java
@@ -7,6 +7,7 @@
 import java.io.IOException;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
+import java.net.URI;
 import java.net.URL;
 
 import javax.swing.JOptionPane;
@@ -37,6 +38,8 @@
     private boolean success;
     private final Component parent;
     private HttpClient connection;
+    
+    private static final String CONNECTION_FAILED_MSG = "Connection to API failed";
 
     /**
      * Constructs a new {@code ApiUrlTestTask}.
@@ -93,7 +96,7 @@
                         url,
                         url
                 ),
-                tr("Connection to API failed"),
+                tr(CONNECTION_FAILED_MSG),
                 JOptionPane.ERROR_MESSAGE,
                 HelpUtil.ht("/Preferences/Connection#ConnectionToAPIFailed")
         );
@@ -110,7 +113,7 @@
                         retCode,
                         url
                 ),
-                tr("Connection to API failed"),
+                tr(CONNECTION_FAILED_MSG),
                 JOptionPane.ERROR_MESSAGE,
                 HelpUtil.ht("/Preferences/Connection#InvalidServerResult")
         );
@@ -126,7 +129,7 @@
                         + "</html>",
                         url
                 ),
-                tr("Connection to API failed"),
+                tr(CONNECTION_FAILED_MSG),
                 JOptionPane.ERROR_MESSAGE,
                 HelpUtil.ht("/Preferences/Connection#InvalidSettings")
         );
@@ -151,16 +154,16 @@
     protected void realRun() throws SAXException, IOException, OsmTransferException {
         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;
             }
@@ -170,8 +173,9 @@
                 connection.connect();
             }
 
-            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;
             }
 
@@ -184,9 +188,10 @@
             }
             success = true;
         } catch (IOException e) {
-            if (canceled)
-                // ignore exceptions
+            if (canceled) {
+                // ignore exceptions
                 return;
+            }
             Logging.error(e);
             alertConnectionFailed();
         }
