Index: trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java	(revision 7193)
+++ trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java	(revision 7205)
@@ -47,4 +47,5 @@
      *
      * @param e the exception
+     * @return The HTML formatted error message to display
      */
     public static String explainOsmApiInitializationException(OsmApiInitializationException e) {
@@ -57,9 +58,4 @@
 
 
-    /**
-     *  Creates the error message
-     *
-     * @param e the exception
-     */
     public static String explainMissingOAuthAccessTokenException(MissingOAuthAccessTokenException e) {
         Main.error(e);
@@ -125,4 +121,5 @@
      *
      * @param e the exception
+     * @return The HTML formatted error message to display
      */
     public static String explainPreconditionFailed(OsmApiException e) {
@@ -312,5 +309,5 @@
      *
      * @param e the exception
-     * @return the message
+     * @return The HTML formatted error message to display
      */
     public static String explainClientTimeout(OsmApiException e) {
@@ -327,5 +324,5 @@
      *
      * @param e the exception
-     * @return the message
+     * @return The HTML formatted error message to display
      */
     public static String explainGenericOsmApiException(OsmApiException e) {
@@ -354,4 +351,5 @@
      *
      * @param e the exception
+     * @return The HTML formatted error message to display
      */
     public static String explainConflict(OsmApiException e) {
@@ -407,4 +405,5 @@
      *
      * @param e the exception
+     * @return The HTML formatted error message to display
      */
     public static String explainChangesetClosedException(ChangesetClosedException e) {
@@ -423,4 +422,5 @@
      *
      * @param e the exception
+     * @return The HTML formatted error message to display
      */
     public static String explainGeneric(Exception e) {
@@ -439,6 +439,6 @@
      *
      * @param e the exception
-     */
-
+     * @return The HTML formatted error message to display
+     */
     public static String explainSecurityException(OsmTransferException e) {
         String apiUrl = e.getUrl();
@@ -461,4 +461,5 @@
      *
      * @param e the exception
+     * @return The HTML formatted error message to display
      */
     public static String explainNestedSocketException(OsmTransferException e) {
@@ -474,4 +475,5 @@
      *
      * @param e the exception
+     * @return The HTML formatted error message to display
      */
     public static String explainNestedIOException(OsmTransferException e) {
@@ -489,4 +491,5 @@
      *
      * @param e the exception
+     * @return The HTML formatted error message to display
      */
     public static String explainNestedIllegalDataException(OsmTransferException e) {
@@ -503,4 +506,5 @@
      *
      * @param e the exception
+     * @return The HTML formatted error message to display
      */
     public static String explainInternalServerError(OsmTransferException e) {
@@ -511,20 +515,32 @@
 
     /**
-     * Explains a {@link OsmApiException} which was thrown because of a bad
-     * request
-     *
-     * @param e the exception
+     * Explains a {@link OsmApiException} which was thrown because of a bad request.
+     *
+     * @param e the exception
+     * @return The HTML formatted error message to display
      */
     public static String explainBadRequest(OsmApiException e) {
-        String apiUrl = OsmApi.getOsmApi().getBaseUrl();
-        String message = tr("The OSM server ''{0}'' reported a bad request.<br>", apiUrl);
-        if (e.getErrorHeader() != null &&
-                (e.getErrorHeader().startsWith("The maximum bbox") ||
-                        e.getErrorHeader().startsWith("You requested too many nodes"))) {
+        String url = null;
+        if (e.getAccessedUrl() != null) {
+            try {
+                url = new URL(e.getAccessedUrl()).getHost();
+            } catch (MalformedURLException e1) {
+                Main.warn(e1);
+            }
+        }
+        if (url == null && e.getUrl() != null) {
+            url = e.getUrl();
+        } else if (url == null) {
+            url = OsmApi.getOsmApi().getBaseUrl();
+        }
+        String message = tr("The OSM server ''{0}'' reported a bad request.<br>", url);
+        String errorHeader = e.getErrorHeader();
+        if (errorHeader != null && (errorHeader.startsWith("The maximum bbox") ||
+                        errorHeader.startsWith("You requested too many nodes"))) {
             message += "<br>"
                 + tr("The area you tried to download is too big or your request was too large."
                         + "<br>Either request a smaller area or use an export file provided by the OSM community.");
-        } else if (e.getErrorHeader() != null) {
-            message += tr("<br>Error message(untranslated): {0}", e.getErrorHeader());
+        } else if (errorHeader != null) {
+            message += tr("<br>Error message(untranslated): {0}", errorHeader);
         }
         Main.error(e);
@@ -537,4 +553,5 @@
      *
      * @param e the exception
+     * @return The HTML formatted error message to display
      */
     public static String explainBandwidthLimitExceeded(OsmApiException e) {
@@ -548,4 +565,5 @@
      *
      * @param e the exception
+     * @return The HTML formatted error message to display
      */
     public static String explainNotFound(OsmApiException e) {
@@ -566,6 +584,6 @@
      *
      * @param e the exception
-     */
-
+     * @return The HTML formatted error message to display
+     */
     public static String explainNestedUnknownHostException(OsmTransferException e) {
         String apiUrl = e.getUrl();
@@ -609,4 +627,5 @@
      *
      * @param e the {@link OsmTransferException}
+     * @return The HTML formatted error message to display
      */
     public static String explainOsmTransferException(OsmTransferException e) {
@@ -647,4 +666,5 @@
      *
      * @param e the exception
+     * @return The HTML formatted error message to display
      */
     public static String explainGoneForUnknownPrimitive(OsmApiException e) {
@@ -662,4 +682,5 @@
      *
      * @param e the {@link Exception}
+     * @return The HTML formatted error message to display
      */
     public static String explainException(Exception e) {
