Index: trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java	(revision 7310)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java	(revision 7312)
@@ -25,4 +25,5 @@
 import org.openstreetmap.josm.data.imagery.ImageryInfo;
 import org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.gui.widgets.JosmTextArea;
 import org.openstreetmap.josm.io.imagery.WMSImagery;
@@ -86,7 +87,15 @@
                             tr("WMS Error"), JOptionPane.ERROR_MESSAGE);
                 } catch (WMSImagery.WMSGetCapabilitiesException ex) {
-                    JOptionPane.showMessageDialog(getParent(), tr("Could not parse WMS layer list."),
-                            tr("WMS Error"), JOptionPane.ERROR_MESSAGE);
-                    Main.error("Could not parse WMS layer list. Incoming data:\n"+ex.getIncomingData());
+                    String incomingData = ex.getIncomingData().trim();
+                    String title = tr("WMS Error");
+                    String message = tr("Could not parse WMS layer list.");
+                    Main.error("Could not parse WMS layer list. Incoming data:\n"+incomingData);
+                    if (incomingData != null
+                            && (incomingData.startsWith("<html>") || incomingData.startsWith("<HTML>"))
+                            && (incomingData.endsWith("</html>") || incomingData.endsWith("</HTML>"))) {
+                        GuiHelper.notifyUserHtmlError(AddWMSLayerPanel.this, title, message, incomingData);
+                    } else {
+                        JOptionPane.showMessageDialog(getParent(), message, title, JOptionPane.ERROR_MESSAGE);
+                    }
                 }
             }
Index: trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java	(revision 7310)
+++ trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java	(revision 7312)
@@ -11,4 +11,5 @@
 import java.awt.Font;
 import java.awt.GraphicsEnvironment;
+import java.awt.GridBagLayout;
 import java.awt.Image;
 import java.awt.Stroke;
@@ -29,5 +30,7 @@
 import javax.swing.Icon;
 import javax.swing.ImageIcon;
+import javax.swing.JLabel;
 import javax.swing.JOptionPane;
+import javax.swing.JPanel;
 import javax.swing.JScrollPane;
 import javax.swing.SwingUtilities;
@@ -36,4 +39,6 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.ExtendedDialog;
+import org.openstreetmap.josm.gui.widgets.HtmlPanel;
+import org.openstreetmap.josm.tools.GBC;
 import org.openstreetmap.josm.tools.ImageProvider;
 
@@ -132,4 +137,9 @@
 
     /**
+     * Warns user about a dangerous action requiring confirmation.
+     * @param title Title of dialog
+     * @param content Content of dialog
+     * @param baseActionIcon Unused? FIXME why is this parameter unused?
+     * @param continueToolTip Tooltip to display for "continue" button
      * @return true if the user wants to cancel, false if they want to continue
      */
@@ -150,4 +160,26 @@
         dlg.setCancelButton(1);
         return dlg.showDialog().getValue() != 2;
+    }
+
+    /**
+     * Notifies user about an error received from an external source as an HTML page.
+     * @param parent Parent component
+     * @param title Title of dialog
+     * @param message Message displayed at the top of the dialog
+     * @param html HTML content to display (real error message)
+     * @since 7312
+     */
+    public static final void notifyUserHtmlError(Component parent, String title, String message, String html) {
+        JPanel p = new JPanel(new GridBagLayout());
+        p.add(new JLabel(message), GBC.eol());
+        p.add(new JLabel(tr("Received error page:")), GBC.eol());
+        JScrollPane sp = embedInVerticalScrollPane(new HtmlPanel(html));
+        sp.setPreferredSize(new Dimension(640, 240));
+        p.add(sp, GBC.eol().fill(GBC.BOTH));
+
+        ExtendedDialog ed = new ExtendedDialog(parent, title, new String[] {tr("OK")});
+        ed.setButtonIcons(new String[] {"ok.png"});
+        ed.setContent(p);
+        ed.showDialog();
     }
 
