Index: /trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java	(revision 9853)
+++ /trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java	(revision 9854)
@@ -11,4 +11,5 @@
 import java.util.List;
 import java.util.Map;
+import java.util.NoSuchElementException;
 import java.util.Set;
 
@@ -32,8 +33,12 @@
     public boolean fromServer;
 
+    /** Creator (usually software) */
     public String creator;
 
+    /** Tracks */
     public final Collection<GpxTrack> tracks = new LinkedList<>();
+    /** Routes */
     public final Collection<GpxRoute> routes = new LinkedList<>();
+    /** Waypoints */
     public final Collection<WayPoint> waypoints = new LinkedList<>();
 
@@ -46,4 +51,8 @@
     public final Set<DataSource> dataSources = new HashSet<>();
 
+    /**
+     * Merges data from another object.
+     * @param other existing GPX data
+     */
     public void mergeFrom(GpxData other) {
         if (storageFile == null && other.storageFile != null) {
@@ -361,4 +370,7 @@
     }
 
+    /**
+     * Resets the internal caches of east/north coordinates.
+     */
     public void resetEastNorthCache() {
         if (waypoints != null) {
@@ -401,4 +413,10 @@
         private final boolean[] trackVisibility;
 
+        /**
+         * Constructs a new {@code LinesIterator}.
+         * @param data GPX data
+         * @param trackVisibility An array indicating which tracks should be
+         * included in the iteration. Can be null, then all tracks are included.
+         */
         public LinesIterator(GpxData data, boolean[] trackVisibility) {
             itTracks = data.tracks.iterator();
@@ -416,4 +434,7 @@
         @Override
         public Collection<WayPoint> next() {
+            if (!hasNext()) {
+                throw new NoSuchElementException();
+            }
             Collection<WayPoint> current = next;
             next = getNext();
Index: /trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java	(revision 9853)
+++ /trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java	(revision 9854)
@@ -7,4 +7,5 @@
 import java.util.Iterator;
 import java.util.List;
+import java.util.NoSuchElementException;
 
 import org.openstreetmap.josm.Main;
@@ -475,4 +476,8 @@
     }
 
+    /**
+     * Converts to list.
+     * @return elements as list
+     */
     public List<T> toList() {
         List<T> a = new ArrayList<>();
@@ -498,5 +503,5 @@
         private int iteratedOver;
 
-        final QBLevel<T> next_content_node(QBLevel<T> q) {
+        final QBLevel<T> nextContentNode(QBLevel<T> q) {
             if (q == null)
                 return null;
@@ -514,5 +519,5 @@
                 currentNode = qb.root;
             } else {
-                currentNode = next_content_node(qb.root);
+                currentNode = nextContentNode(qb.root);
             }
             iteratedOver = 0;
@@ -531,5 +536,5 @@
             while ((currentNode.content == null) || (contentIndex >= currentNode.content.size())) {
                 contentIndex = 0;
-                currentNode = next_content_node(currentNode);
+                currentNode = nextContentNode(currentNode);
                 if (currentNode == null) {
                     break;
@@ -544,4 +549,6 @@
         public T next() {
             T ret = peek();
+            if (ret == null)
+                throw new NoSuchElementException();
             contentIndex++;
             iteratedOver++;
@@ -576,5 +583,5 @@
     }
 
-    public List<T> search(BBox search_bbox) {
+    public List<T> search(BBox searchBbox) {
         List<T> ret = new ArrayList<>();
         // Doing this cuts down search cost on a real-life data set by about 25%
@@ -583,5 +590,5 @@
         }
         // Walk back up the tree when the last search spot can not cover the current search
-        while (searchCache != null && !searchCache.bbox().bounds(search_bbox)) {
+        while (searchCache != null && !searchCache.bbox().bounds(searchBbox)) {
             searchCache = searchCache.parent;
         }
@@ -589,5 +596,5 @@
         if (searchCache == null) {
             searchCache = root;
-            Main.info("bbox: " + search_bbox + " is out of the world");
+            Main.info("bbox: " + searchBbox + " is out of the world");
         }
 
@@ -595,10 +602,10 @@
         QBLevel<T> tmp = searchCache.parent;
 
-        searchCache.search(search_bbox, ret);
+        searchCache.search(searchBbox, ret);
 
         // A way that spans this bucket may be stored in one
         // of the nodes which is a parent of the search cache
         while (tmp != null) {
-            tmp.search_contents(search_bbox, ret);
+            tmp.search_contents(searchBbox, ret);
             tmp = tmp.parent;
         }
Index: /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java	(revision 9853)
+++ /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java	(revision 9854)
@@ -33,4 +33,5 @@
 import java.util.List;
 import java.util.Map;
+import java.util.NoSuchElementException;
 import java.util.concurrent.ForkJoinPool;
 import java.util.concurrent.ForkJoinTask;
@@ -94,5 +95,5 @@
      *
      * There is no intention, to handle consecutive duplicate Nodes in a
-     * perfect way, but it is should not throw an exception.
+     * perfect way, but it should not throw an exception.
      */
     private class OffsetIterator implements Iterator<Point> {
@@ -122,5 +123,9 @@
         @Override
         public Point next() {
-            if (Math.abs(offset) < 0.1d) return nc.getPoint(nodes.get(idx++));
+            if (!hasNext())
+                throw new NoSuchElementException();
+
+            if (Math.abs(offset) < 0.1d)
+                return nc.getPoint(nodes.get(idx++));
 
             Point current = nc.getPoint(nodes.get(idx));
Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java	(revision 9853)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java	(revision 9854)
@@ -22,4 +22,5 @@
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.NoSuchElementException;
 import java.util.Set;
 import java.util.concurrent.locks.ReadWriteLock;
@@ -157,9 +158,11 @@
             @Override
             public boolean hasNext() {
-                return next >= 0;
+                return next >= 0 && next < rules.size();
             }
 
             @Override
             public MapCSSRule next() {
+                if (!hasNext())
+                    throw new NoSuchElementException();
                 MapCSSRule rule = rules.get(next);
                 next = ruleCandidates.nextSetBit(next + 1);
Index: /trunk/src/org/openstreetmap/josm/gui/widgets/ComboBoxHistory.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/widgets/ComboBoxHistory.java	(revision 9853)
+++ /trunk/src/org/openstreetmap/josm/gui/widgets/ComboBoxHistory.java	(revision 9854)
@@ -5,4 +5,5 @@
 import java.util.Iterator;
 import java.util.List;
+import java.util.NoSuchElementException;
 
 import javax.swing.DefaultComboBoxModel;
@@ -79,11 +80,11 @@
             @Override
             public boolean hasNext() {
-                if (position < getSize()-1 && getSize() > 0)
-                    return true;
-                return false;
+                return position < getSize()-1 && getSize() > 0;
             }
 
             @Override
             public AutoCompletionListItem next() {
+                if (!hasNext())
+                    throw new NoSuchElementException();
                 position++;
                 return getElementAt(position);
Index: /trunk/src/org/openstreetmap/josm/tools/SubclassFilteredCollection.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/SubclassFilteredCollection.java	(revision 9853)
+++ /trunk/src/org/openstreetmap/josm/tools/SubclassFilteredCollection.java	(revision 9854)
@@ -5,4 +5,5 @@
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.NoSuchElementException;
 
 /**
@@ -51,5 +52,6 @@
         @Override
         public T next() {
-            findNext();
+            if (!hasNext())
+                throw new NoSuchElementException();
             S old = current;
             current = null;
