Index: trunk/test/data/regress/18106/uncon3.osm
===================================================================
--- trunk/test/data/regress/18106/uncon3.osm	(revision 15335)
+++ trunk/test/data/regress/18106/uncon3.osm	(revision 15335)
@@ -0,0 +1,30 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<osm version='0.6' generator='JOSM'>
+  <node id='-151993' action='modify' visible='true' lat='-6.37298855155' lon='-89.28101090197' />
+  <node id='-151995' action='modify' visible='true' lat='-6.37284430385' lon='-89.28088730653' />
+  <node id='-151997' action='modify' visible='true' lat='-6.37284794506' lon='-89.28088216792' />
+  <node id='-151999' action='modify' visible='true' lat='-6.37289236259' lon='-89.28092848459' />
+  <node id='-152001' action='modify' visible='true' lat='-6.37289741983' lon='-89.28092204994' />
+  <node id='-152003' action='modify' visible='true' lat='-6.37287761379' lon='-89.28089921398' />
+  <node id='-152005' action='modify' visible='true' lat='-6.37289334962' lon='-89.28090860684' />
+  <node id='-152269' action='modify' visible='true' lat='-6.37297269834' lon='-89.28099731849' />
+  <way id='-152203' action='modify' visible='true'>
+    <nd ref='-151993' />
+    <nd ref='-152269' />
+    <nd ref='-151999' />
+    <nd ref='-151995' />
+    <tag k='highway' v='residential' />
+  </way>
+  <way id='-152204' action='modify' visible='true'>
+    <nd ref='-151999' />
+    <nd ref='-152001' />
+    <nd ref='-152005' />
+    <tag k='highway' v='footway' />
+  </way>
+  <way id='-152208' action='modify' visible='true'>
+    <nd ref='-152005' />
+    <nd ref='-152003' />
+    <nd ref='-151997' />
+    <tag k='highway' v='footway' />
+  </way>
+</osm>
Index: trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java	(revision 15334)
+++ trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java	(revision 15335)
@@ -14,5 +14,8 @@
 import org.junit.Test;
 import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
 import org.openstreetmap.josm.io.IllegalDataException;
@@ -35,5 +38,4 @@
         JOSMFixture.createUnitTestFixture().init();
         bib.initialize();
-        bib.startTest(null);
     }
 
@@ -48,4 +50,47 @@
         try (InputStream fis = Files.newInputStream(Paths.get("data_nodist/UnconnectedWaysTest.osm"))) {
             final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
+            MainApplication.getLayerManager().addLayer(new OsmDataLayer(ds, null, null));
+
+            bib.startTest(null);
+            bib.visit(ds.allPrimitives());
+            bib.endTest();
+            assertThat(bib.getErrors(), isEmpty());
+        }
+    }
+
+    /**
+     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/6313">Bug #18051</a>.
+     * @throws IOException if any I/O error occurs
+     * @throws IllegalDataException if the OSM data cannot be parsed
+     * @throws FileNotFoundException if the data file cannot be found
+     */
+    @Test
+    public void testTicket18051() throws IOException, IllegalDataException, FileNotFoundException {
+        try (InputStream fis = TestUtils.getRegressionDataStream(18051, "modified-ways.osm.bz2")) {
+            final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
+            MainApplication.getLayerManager().addLayer(new OsmDataLayer(ds, null, null));
+
+            bib.startTest(null);
+            bib.setBeforeUpload(true);
+            bib.visit(ds.allModifiedPrimitives());
+            bib.endTest();
+            assertThat(bib.getErrors(), isEmpty());
+        }
+    }
+
+    /**
+     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/6313">Bug #18106</a>.
+     * @throws IOException if any I/O error occurs
+     * @throws IllegalDataException if the OSM data cannot be parsed
+     * @throws FileNotFoundException if the data file cannot be found
+     */
+    @Test
+    public void testTicket18106() throws IOException, IllegalDataException, FileNotFoundException {
+        try (InputStream fis = TestUtils.getRegressionDataStream(18106, "uncon3.osm")) {
+            final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
+            MainApplication.getLayerManager().addLayer(new OsmDataLayer(ds, null, null));
+
+            bib.startTest(null);
+            bib.setBeforeUpload(true);
             bib.visit(ds.allPrimitives());
             bib.endTest();
