Index: trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java	(revision 6155)
+++ trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java	(revision 6156)
@@ -42,5 +42,5 @@
 /**
  * Combines multiple ways into one.
- *
+ * @since 213
  */
 public class CombineWayAction extends JosmAction {
@@ -48,4 +48,7 @@
     private static final BooleanProperty PROP_REVERSE_WAY = new BooleanProperty("tag-correction.reverse-way", true);
 
+    /**
+     * Constructs a new {@code CombineWayAction}.
+     */
     public CombineWayAction() {
         super(tr("Combine Way"), "combineway", tr("Combine several ways into one."),
@@ -123,5 +126,6 @@
         List<Way> unreversedWays = new LinkedList<Way>();
         for (Way w: ways) {
-            if ((path.indexOf(w.getNode(0)) + 1) == path.lastIndexOf(w.getNode(1))) {
+            // Treat zero or one-node ways as unreversed as Combine action action is a good way to fix them (see #8971)
+            if (w.getNodesCount() < 2 || (path.indexOf(w.getNode(0)) + 1) == path.lastIndexOf(w.getNode(1))) {
                 unreversedWays.add(w);
             } else {
@@ -247,26 +251,49 @@
     }
 
+    /**
+     * A pair of nodes.
+     */
     static public class NodePair {
-        private Node a;
-        private Node b;
+        private final Node a;
+        private final Node b;
+        
+        /**
+         * Constructs a new {@code NodePair}.
+         * @param a The first node
+         * @param b The second node
+         */
         public NodePair(Node a, Node b) {
-            this.a =a;
+            this.a = a;
             this.b = b;
         }
 
+        /**
+         * Constructs a new {@code NodePair}.
+         * @param pair An existing {@code Pair} of nodes
+         */
         public NodePair(Pair<Node,Node> pair) {
-            this.a = pair.a;
-            this.b = pair.b;
-        }
-
+            this(pair.a, pair.b);
+        }
+
+        /**
+         * Constructs a new {@code NodePair}.
+         * @param other An existing {@code NodePair}
+         */
         public NodePair(NodePair other) {
-            this.a = other.a;
-            this.b = other.b;
-        }
-
+            this(other.a, other.b);
+        }
+
+        /**
+         * Replies the first node.
+         * @return The first node
+         */
         public Node getA() {
             return a;
         }
 
+        /**
+         * Replies the second node
+         * @return The second node
+         */
         public Node getB() {
             return b;
@@ -304,4 +331,9 @@
         }
 
+        /**
+         * Determines if this pair contains the given node.
+         * @param n The node to look for
+         * @return {@code true} if {@code n} is in the pair, {@code false} otherwise
+         */
         public boolean contains(Node n) {
             return a == n || b == n;
@@ -316,4 +348,5 @@
             return result;
         }
+        
         @Override
         public boolean equals(Object obj) {
@@ -458,4 +491,7 @@
         }
 
+        /**
+         * Constructs a new {@code NodeGraph}.
+         */
         public NodeGraph() {
             edges = new LinkedHashSet<NodePair>();
Index: trunk/src/org/openstreetmap/josm/tools/Pair.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Pair.java	(revision 6155)
+++ trunk/src/org/openstreetmap/josm/tools/Pair.java	(revision 6156)
@@ -4,10 +4,26 @@
 
 /**
- * A pair.
+ * A pair of objects.
+ * @param <A> Type of first item
+ * @param <B> Type of second item
+ * @since 429
  */
 public final class Pair<A,B> {
+    
+    /**
+     * The first item
+     */
     public A a;
+    
+    /**
+     * The second item
+     */
     public B b;
 
+    /**
+     * Constructs a new {@code Pair}.
+     * @param a The first item
+     * @param b The second item
+     */
     public Pair(A a, B b) {
         this.a = a;
@@ -48,5 +64,10 @@
     }
 
-    /* convenience constructor method */
+    /**
+     * Convenient constructor method 
+     * @param u The first item
+     * @param v The second item
+     * @return The newly created Pair(u,v)
+     */
     public static <U,V> Pair<U,V> create(U u, V v) {
         return new Pair<U,V>(u,v);
