Index: trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java	(revision 11558)
+++ trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java	(revision 11559)
@@ -110,6 +110,10 @@
         if (url == null) {
             synchronized (this) {
-                if (url == null)
-                    url = new URL(tile.getUrl());
+                if (url == null) {
+                    String sUrl = tile.getUrl();
+                    if (!"".equals(sUrl)) {
+                        url = new URL(sUrl);
+                    }
+                }
             }
         }
@@ -151,5 +155,5 @@
         try {
             super.submit(this, force);
-        } catch (IOException e) {
+        } catch (IOException | IllegalArgumentException e) {
             // if we fail to submit the job, mark tile as loaded and set error message
             Main.warn(e, false);
Index: trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java	(revision 11558)
+++ trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java	(revision 11559)
@@ -11,4 +11,5 @@
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -17,4 +18,5 @@
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
@@ -27,4 +29,5 @@
 import java.util.stream.Collectors;
 
+import javax.imageio.ImageIO;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
@@ -148,11 +151,10 @@
 
         Layer(Layer l) {
-            if (l != null) {
-                format = l.format;
-                name = l.name;
-                baseUrl = l.baseUrl;
-                style = l.style;
-                tileMatrixSet = new TileMatrixSet(l.tileMatrixSet);
-            }
+            Objects.requireNonNull(l);
+            format = l.format;
+            name = l.name;
+            baseUrl = l.baseUrl;
+            style = l.style;
+            tileMatrixSet = new TileMatrixSet(l.tileMatrixSet);
         }
 
@@ -384,4 +386,5 @@
         Layer layer = new Layer();
         Stack<QName> tagStack = new Stack<>();
+        List<String> supportedMimeTypes = Arrays.asList(ImageIO.getReaderMIMETypes());
 
         for (int event = reader.getEventType();
@@ -392,5 +395,8 @@
                 if (tagStack.size() == 2) {
                     if (QN_FORMAT.equals(reader.getName())) {
-                        layer.format = reader.getElementText();
+                        String format = reader.getElementText();
+                        if (supportedMimeTypes.contains(format)) {
+                            layer.format = format;
+                        }
                     } else if (GetCapabilitiesParseHelper.QN_OWS_IDENTIFIER.equals(reader.getName())) {
                         layer.name = reader.getElementText();
