Index: trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java	(revision 5845)
+++ trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java	(revision 5847)
@@ -884,5 +884,5 @@
                 return null;
             else
-                return (long) ((Way) osm).getNodesCount();
+                return (long) ((Way) osm).getRealNodesCount();
         }
 
Index: trunk/src/org/openstreetmap/josm/data/osm/Way.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 5845)
+++ trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 5847)
@@ -96,7 +96,7 @@
 
     /**
-     * Replies the number of nodes in this ways.
-     *
-     * @return the number of nodes in this ways.
+     * Replies the number of nodes in this way.
+     *
+     * @return the number of nodes in this way.
      * @since 1862
      */
@@ -104,4 +104,18 @@
     public int getNodesCount() {
         return nodes.length;
+    }
+    
+    /**
+     * Replies the real number of nodes in this way (full number of nodes minus one if this way is closed)
+     *
+     * @return the real number of nodes in this way.
+     * @since 5847
+     * 
+     * @see #getNodesCount()
+     * @see #isClosed()
+     */
+    public int getRealNodesCount() {
+        int count = getNodesCount();
+        return isClosed() ? count-1 : count;
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java	(revision 5845)
+++ trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java	(revision 5847)
@@ -267,8 +267,5 @@
             }
 
-            int nodesNo = way.getNodesCount();
-            if (nodesNo > 1 && way.isClosed()) {
-                nodesNo--;
-            }
+            int nodesNo = way.getRealNodesCount();
             /* note: length == 0 should no longer happen, but leave the bracket code
                nevertheless, who knows what future brings */
