Index: trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java	(revision 13447)
+++ trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java	(revision 13449)
@@ -7,4 +7,5 @@
 import java.io.IOException;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.util.HashSet;
 import java.util.List;
@@ -17,4 +18,6 @@
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.apache.commons.jcs.access.behavior.ICacheAccess;
@@ -42,4 +45,5 @@
     private static final LongProperty MAXIMUM_EXPIRES = new LongProperty("imagery.generic.maximum_expires", TimeUnit.DAYS.toMillis(30));
     private static final LongProperty MINIMUM_EXPIRES = new LongProperty("imagery.generic.minimum_expires", TimeUnit.HOURS.toMillis(1));
+    private static final Pattern SERVICE_EXCEPTION_PATTERN = Pattern.compile("(?s).+<ServiceException>(.+)</ServiceException>.+");
     protected final Tile tile;
     private volatile URL url;
@@ -270,13 +274,21 @@
             byte[] content = object.getContent();
             if (content.length > 0) {
-                try {
-                    tile.loadImage(new ByteArrayInputStream(content));
+                try (ByteArrayInputStream in = new ByteArrayInputStream(content)) {
+                    tile.loadImage(in);
+                    if (tile.getImage() == null) {
+                        String s = new String(content, StandardCharsets.UTF_8);
+                        Matcher m = SERVICE_EXCEPTION_PATTERN.matcher(s);
+                        if (m.matches()) {
+                            tile.setError(m.group(1));
+                            Logging.error(m.group(1));
+                            Logging.debug(s);
+                        } else {
+                            tile.setError(tr("Could not load image from tile server"));
+                        }
+                        return false;
+                    }
                 } catch (UnsatisfiedLinkError e) {
                     throw new IOException(e);
                 }
-                if (tile.getImage() == null) {
-                    tile.setError(tr("Could not load image from tile server"));
-                    return false;
-                }
             }
         }
