Index: trunk/src/org/openstreetmap/josm/data/osm/Way.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 8319)
+++ trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 8320)
@@ -685,4 +685,28 @@
 
     /**
+     * Replies the length of the longest segement of the way, in metres, as computed by {@link LatLon#greatCircleDistance}.
+     * @return The length of the segment, in metres
+     * @since 4138
+     */
+    public double getLongestSegmentLength() {
+        double length = 0;
+        Node lastN = null;
+        for (Node n:nodes) {
+            if (lastN != null) {
+                LatLon lastNcoor = lastN.getCoor();
+                LatLon coor = n.getCoor();
+                if (lastNcoor != null && coor != null) {
+                    double l = coor.greatCircleDistance(lastNcoor);
+                    if (l > length) {
+                        length = l;
+                    }
+                }
+            }
+            lastN = n;
+        }
+        return length;
+    }
+
+    /**
      * Tests if this way is a oneway.
      * @return {@code 1} if the way is a oneway,
Index: trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java	(revision 8319)
+++ trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java	(revision 8320)
@@ -40,4 +40,5 @@
 import org.openstreetmap.josm.data.validation.tests.InternetTags;
 import org.openstreetmap.josm.data.validation.tests.Lanes;
+import org.openstreetmap.josm.data.validation.tests.LongSegment;
 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker;
 import org.openstreetmap.josm.data.validation.tests.MultipolygonTest;
@@ -125,4 +126,5 @@
         InternetTags.class, // 3300 .. 3399
         ApiCapabilitiesTest.class, // 3400 .. 3499
+        LongSegment.class, // 3500 .. 3599
     };
 
Index: trunk/src/org/openstreetmap/josm/data/validation/tests/LongSegment.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/LongSegment.java	(revision 8320)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/LongSegment.java	(revision 8320)
@@ -0,0 +1,53 @@
+// License: GPL. See LICENSE file for details.
+package org.openstreetmap.josm.data.validation.tests;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.validation.Severity;
+import org.openstreetmap.josm.data.validation.Test;
+import org.openstreetmap.josm.data.validation.TestError;
+import org.openstreetmap.josm.gui.progress.ProgressMonitor;
+
+/**
+ * Checks for untagged ways
+ *
+ * @since 8320
+ */
+public class LongSegment extends Test {
+
+    /** Long segment error */
+    protected static final int LONG_SEGMENT    = 3501;
+    /** Maximum segment length for this test */
+    protected int maxlength;
+
+    /**
+     * Constructor
+     */
+    public LongSegment() {
+        super(tr("Long segments"),
+              tr("This for long way segements, which are usually errors."));
+    }
+
+    @Override
+    public void visit(Way w) {
+        Double length = w.getLongestSegmentLength();
+        if(length > maxlength) {
+            length /= 1000.0;
+            errors.add(new TestError(this, Severity.WARNING, tr("Very long segment of {0} kilometers", length.intValue()), LONG_SEGMENT, w));
+        }
+    }
+
+    @Override
+    public void startTest(ProgressMonitor monitor) {
+        super.startTest(monitor);
+        maxlength = Main.pref.getInteger("validator.maximum.segment.length", 15000);
+    }
+
+    @Override
+    public boolean isPrimitiveUsable(OsmPrimitive p) {
+        return p.isUsable() && p instanceof Way && ((Way) p).getNodesCount() > 1; // test only Ways with at least 2 nodes
+    }
+}
