Index: trunk/test/unit/org/openstreetmap/josm/actions/SessionLoadActionTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/actions/SessionLoadActionTest.java	(revision 15070)
+++ trunk/test/unit/org/openstreetmap/josm/actions/SessionLoadActionTest.java	(revision 15070)
@@ -0,0 +1,37 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.actions;
+
+import static org.junit.Assert.assertFalse;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.openstreetmap.josm.data.imagery.ImageryInfo;
+import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
+import org.openstreetmap.josm.gui.layer.TMSLayer;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
+/**
+ * Unit tests for class {@link SessionLoadAction}.
+ */
+public class SessionLoadActionTest {
+
+    /**
+     * Setup test.
+     */
+    @Rule
+    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
+    public JOSMTestRules test = new JOSMTestRules().main().projection();
+
+    /**
+     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/17702">Bug #17702</a>.
+     */
+    @Test
+    public void testTicket17702() {
+        assertFalse(SessionLoadAction.Loader.addLayer(new TMSLayer(new ImageryInfo(
+                "Bing Карта (GLOBALCITY)",
+                "http://ecn.dynamic.t{switch:1,2,3}.tiles.virtualearth.net/comp/ch/{$q}?mkt=en-us&it=G,VE,BX,L,LA&shading=hill&og=2&n=z",
+                ImageryType.TMS.getTypeString(), null, null))));
+    }
+}
Index: trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java	(revision 15069)
+++ trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java	(revision 15070)
@@ -6,6 +6,9 @@
 import static org.junit.Assert.assertTrue;
 
+import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 
@@ -154,3 +157,35 @@
         assertEquals(174, layer.getNoteData().getNotes().size());
     }
+
+    /**
+     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/17701">Bug #17701</a>.
+     * @throws Exception if an error occurs
+     */
+    @Test
+    public void testTicket17701() throws Exception {
+        try (InputStream in = new ByteArrayInputStream(("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
+                "<josm-session version=\"0.1\">\n" +
+                "    <layers active=\"1\">\n" +
+                "        <layer index=\"1\" name=\"GPS-треки OpenStreetMap\" type=\"imagery\" version=\"0.1\" visible=\"true\">\n" +
+                "            <id>osm-gps</id>\n" +
+                "            <type>tms</type>\n" +
+                "            <url>https://{switch:a,b,c}.gps-tile.openstreetmap.org/lines/{zoom}/{x}/{y}.png</url>\n" +
+                "            <attribution-text>© OpenStreetMap contributors</attribution-text>\n" +
+                "            <attribution-url>https://www.openstreetmap.org/copyright</attribution-url>\n" +
+                "            <max-zoom>20</max-zoom>\n" +
+                "            <cookies/>\n" +
+                "            <description>Общедоступные GPS-треки, загруженные на OpenStreetMap.</description>\n" +
+                "            <valid-georeference>true</valid-georeference>\n" +
+                "            <overlay>true</overlay>\n" +
+                "            <show-errors>true</show-errors>\n" +
+                "            <automatic-downloading>true</automatic-downloading>\n" +
+                "            <automatically-change-resolution>true</automatically-change-resolution>\n" +
+                "        </layer>\r\n" +
+                "    </layers>\n" +
+                "</josm-session>").getBytes(StandardCharsets.UTF_8))) {
+            SessionReader reader = new SessionReader();
+            reader.loadSession(in, null, false, null);
+            assertTrue(reader.getLayers().isEmpty());
+        }
+    }
 }
