Index: /trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java	(revision 7465)
+++ /trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java	(revision 7466)
@@ -211,5 +211,6 @@
      * @return the index of the selected option or {@link JOptionPane#CLOSED_OPTION}
      */
-    public static int showOptionDialog(Component parentComponent, Object msg, String title, int messageType, Icon icon, final ButtonSpec[] options, final ButtonSpec defaultOption, final String helpTopic)  {
+    public static int showOptionDialog(Component parentComponent, Object msg, String title, int messageType,
+            Icon icon, final ButtonSpec[] options, final ButtonSpec defaultOption, final String helpTopic)  {
         final List<JButton> buttons = createOptionButtons(options, helpTopic);
         if (helpTopic != null) {
@@ -318,14 +319,20 @@
      * @see #showOptionDialog(Component, Object, String, int, Icon, ButtonSpec[], ButtonSpec, String)
      */
-    public static int showOptionDialog(Component parentComponent, Object msg, String title, int messageType,final String helpTopic)  {
-        return showOptionDialog(parentComponent, msg, title, messageType, null,null,null, helpTopic);
+    public static int showOptionDialog(Component parentComponent, Object msg, String title, int messageType, String helpTopic)  {
+        return showOptionDialog(parentComponent, msg, title, messageType, null, null, null, helpTopic);
     }
 
     /**
      * Run it in Event Dispatch Thread.
-     * This version does not return anything, so it is more like showMessageDialog.
+     * This version does not return anything, so it is more like {@code showMessageDialog}.
      *
      * It can be used, when you need to show a message dialog from a worker thread,
-     * e.g. from PleaseWaitRunnable
+     * e.g. from {@code PleaseWaitRunnable}.
+     *
+     * @param parentComponent the parent component
+     * @param msg the message
+     * @param title the title
+     * @param messageType the message type (see {@link JOptionPane})
+     * @param helpTopic the help topic. Can be null.
      */
     public static void showMessageDialogInEDT(final Component parentComponent, final Object msg, final String title, final int messageType, final String helpTopic)  {
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java	(revision 7465)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java	(revision 7466)
@@ -5,11 +5,8 @@
 
 import java.awt.Component;
-import java.io.BufferedReader;
 import java.io.IOException;
-import java.io.InputStreamReader;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.nio.charset.StandardCharsets;
 
 import javax.swing.JOptionPane;
@@ -19,4 +16,6 @@
 import org.openstreetmap.josm.gui.PleaseWaitRunnable;
 import org.openstreetmap.josm.gui.help.HelpUtil;
+import org.openstreetmap.josm.io.IllegalDataException;
+import org.openstreetmap.josm.io.OsmChangesetParser;
 import org.openstreetmap.josm.io.OsmTransferException;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
@@ -33,16 +32,16 @@
  * to "https://x.y.y/api/0/capabilities" or "https://x.y.y/a/capabilities" with valid capabilities. If we get
  * valid capabilities with an URL we therefore can't be sure that the base URL is valid API URL.
- *
+ * @since 2745
  */
-public class ApiUrlTestTask extends PleaseWaitRunnable{
-
-    private String url;
+public class ApiUrlTestTask extends PleaseWaitRunnable {
+
+    private final String url;
     private boolean canceled;
     private boolean success;
-    private Component parent;
+    private final Component parent;
     private HttpURLConnection connection;
 
     /**
-     * Creates the task
+     * Constructs a new {@code ApiUrlTestTask}.
      *
      * @param parent the parent component relative to which the {@link PleaseWaitRunnable}-Dialog is displayed
@@ -58,5 +57,5 @@
 
     protected void alertInvalidUrl(String url) {
-        HelpAwareOptionPane.showOptionDialog(
+        HelpAwareOptionPane.showMessageDialogInEDT(
                 parent,
                 tr("<html>"
@@ -73,5 +72,5 @@
 
     protected void alertInvalidChangesetUrl(String url) {
-        HelpAwareOptionPane.showOptionDialog(
+        HelpAwareOptionPane.showMessageDialogInEDT(
                 parent,
                 tr("<html>"
@@ -89,5 +88,5 @@
 
     protected void alertConnectionFailed() {
-        HelpAwareOptionPane.showOptionDialog(
+        HelpAwareOptionPane.showMessageDialogInEDT(
                 parent,
                 tr("<html>"
@@ -105,5 +104,5 @@
 
     protected void alertInvalidServerResult(int retCode) {
-        HelpAwareOptionPane.showOptionDialog(
+        HelpAwareOptionPane.showMessageDialogInEDT(
                 parent,
                 tr("<html>"
@@ -122,5 +121,5 @@
 
     protected void alertInvalidChangesetList() {
-        HelpAwareOptionPane.showOptionDialog(
+        HelpAwareOptionPane.showMessageDialogInEDT(
                 parent,
                 tr("<html>"
@@ -194,17 +193,15 @@
                 return;
             }
-            StringBuilder changesets = new StringBuilder();
-            try (BufferedReader bin = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
-                String line;
-                while ((line = bin.readLine()) != null) {
-                    changesets.append(line).append("\n");
+
+            try {
+                OsmChangesetParser.parse(connection.getInputStream(), progressMonitor.createSubTaskMonitor(1, true));
+            } catch (IllegalDataException e) {
+                if (e.getCause() instanceof IOException) {
+                    throw (IOException) e.getCause();
+                } else {
+                    Main.warn(e.getMessage());
+                    alertInvalidChangesetList();
+                    return;
                 }
-            }
-            if (! (changesets.toString().contains("<osm") && changesets.toString().contains("</osm>"))) {
-                // heuristic: if there isn't an opening and closing "<osm>" tag in the returned content,
-                // then we didn't get a list of changesets in return. Could be replaced by explicitly parsing
-                // the result but currently not worth the effort.
-                alertInvalidChangesetList();
-                return;
             }
             success = true;
