Index: trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java	(revision 14267)
+++ trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java	(revision 14268)
@@ -181,10 +181,6 @@
                     int httpStatusCode = attributes.getResponseCode();
                     if (httpStatusCode >= 400 && !isNoTileAtZoom()) {
-                        if (attributes.getErrorMessage() == null) {
-                            tile.setError(tr("HTTP error {0} when loading tiles", httpStatusCode));
-                        } else {
-                            tile.setError(tr("Error downloading tiles: {0}", attributes.getErrorMessage()));
-                        }
                         status = false;
+                        handleError(attributes);
                     }
                 }
@@ -192,5 +188,5 @@
                 break;
             case FAILURE:
-                tile.setError("Problem loading tile");
+                handleError(attributes);
                 tryLoadTileImage(object);
                 break;
@@ -215,4 +211,22 @@
                 }
             }
+        }
+    }
+
+    private void handleError(CacheEntryAttributes attributes) {
+        if (attributes != null) {
+            int httpStatusCode = attributes.getResponseCode();
+            if (attributes.getErrorMessage() == null) {
+                tile.setError(tr("HTTP error {0} when loading tiles", httpStatusCode));
+            } else {
+                tile.setError(tr("Error downloading tiles: {0}", attributes.getErrorMessage()));
+            }
+            if (httpStatusCode >= 500 && httpStatusCode != 599) {
+                // httpStatusCode = 599 is set by JCSCachedTileLoaderJob on IOException
+                tile.setLoaded(false); // treat 500 errors as temporary and try to load it again
+            }
+        } else {
+            tile.setError(tr("Problem loading tile"));
+            // treat unknown errors as permanent and do not try to load tile again
         }
     }
Index: trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 14267)
+++ trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 14268)
@@ -303,5 +303,4 @@
             tile.setImage(null);
         }
-        tile.setLoaded(success);
         invalidateLater();
         Logging.debug("tileLoadingFinished() tile: {0} success: {1}", tile, success);
@@ -461,4 +460,8 @@
                     }
                 }
+                content.add(Arrays.asList(tr("Status:"), tr(tile.getStatus())));
+                content.add(Arrays.asList(tr("Loaded:"), tr(Boolean.toString(tile.isLoaded()))));
+                content.add(Arrays.asList(tr("Loading:"), tr(Boolean.toString(tile.isLoading()))));
+                content.add(Arrays.asList(tr("Error:"), tr(Boolean.toString(tile.hasError()))));
                 for (List<String> entry: content) {
                     panel.add(new JLabel(entry.get(0) + ':'), GBC.std());
@@ -889,5 +892,5 @@
         if (tile == null)
             return false;
-        if (!force && (tile.isLoaded() || tile.hasError()))
+        if (!force && tile.isLoaded())
             return false;
         if (tile.isLoading())
