Index: trunk/src/org/openstreetmap/josm/io/AbstractReader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/AbstractReader.java	(revision 8319)
+++ trunk/src/org/openstreetmap/josm/io/AbstractReader.java	(revision 8332)
@@ -9,4 +9,5 @@
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import org.openstreetmap.josm.Main;
@@ -82,8 +83,9 @@
      */
     protected void processWaysAfterParsing() throws IllegalDataException{
-        for (Long externalWayId: ways.keySet()) {
+        for (Entry<Long, Collection<Long>> entry : ways.entrySet()) {
+            Long externalWayId = entry.getKey();
             Way w = (Way)externalIdMap.get(new SimplePrimitiveId(externalWayId, OsmPrimitiveType.WAY));
             List<Node> wayNodes = new ArrayList<>();
-            for (long id : ways.get(externalWayId)) {
+            for (long id : entry.getValue()) {
                 Node n = (Node)externalIdMap.get(new SimplePrimitiveId(id, OsmPrimitiveType.NODE));
                 if (n == null) {
@@ -132,10 +134,11 @@
         }
 
-        for (Long externalRelationId : relations.keySet()) {
+        for (Entry<Long, Collection<RelationMemberData>> entry : relations.entrySet()) {
+            Long externalRelationId = entry.getKey();
             Relation relation = (Relation) externalIdMap.get(
                     new SimplePrimitiveId(externalRelationId, OsmPrimitiveType.RELATION)
             );
             List<RelationMember> relationMembers = new ArrayList<>();
-            for (RelationMemberData rm : relations.get(externalRelationId)) {
+            for (RelationMemberData rm : entry.getValue()) {
                 OsmPrimitive primitive = null;
 
Index: trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java	(revision 8319)
+++ trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java	(revision 8332)
@@ -19,15 +19,19 @@
  * use {@link RuntimeException} if no exception must be handled.
  * @author xeen
- *
+ * @since 1450
  */
 public abstract class CacheCustomContent<T extends Throwable> {
-    /**
-     * Common intervals
-     */
+
+    /** Update interval meaning an update is always needed */
     public static final int INTERVAL_ALWAYS = -1;
+    /** Update interval meaning an update is needed each hour */
     public static final int INTERVAL_HOURLY = 60*60;
+    /** Update interval meaning an update is needed each day */
     public static final int INTERVAL_DAILY = INTERVAL_HOURLY * 24;
+    /** Update interval meaning an update is needed each week */
     public static final int INTERVAL_WEEKLY = INTERVAL_DAILY * 7;
+    /** Update interval meaning an update is needed each month */
     public static final int INTERVAL_MONTHLY = INTERVAL_WEEKLY * 4;
+    /** Update interval meaning an update is never needed */
     public static final int INTERVAL_NEVER = Integer.MAX_VALUE;
 
@@ -61,16 +65,8 @@
 
     /**
-     * This function serves as a comfort hook to perform additional checks if the cache is valid
-     * @return True if the cached copy is still valid
-     */
-    protected boolean isCacheValid() {
-        return true;
-    }
-
-    /**
      * Initializes the class. Note that all read data will be stored in memory until it is flushed
      * by flushData().
-     * @param ident
-     * @param updateInterval
+     * @param ident ident that identifies the stored file. Includes file-ending.
+     * @param updateInterval update interval in seconds. -1 means always
      */
     public CacheCustomContent(String ident, int updateInterval) {
@@ -78,4 +74,12 @@
         this.updateInterval = updateInterval;
         this.path = new File(Main.pref.getCacheDirectory(), ident);
+    }
+
+    /**
+     * This function serves as a comfort hook to perform additional checks if the cache is valid
+     * @return True if the cached copy is still valid
+     */
+    protected boolean isCacheValid() {
+        return true;
     }
 
@@ -104,4 +108,5 @@
      * Updates data if required
      * @return Returns the data
+     * @throws T if an error occurs
      */
     public byte[] updateIfRequired() throws T {
@@ -114,4 +119,5 @@
      * Updates data if required
      * @return Returns the data as string
+     * @throws T if an error occurs
      */
     public String updateIfRequiredString() throws T {
@@ -124,4 +130,5 @@
      * Executes an update regardless of updateInterval
      * @return Returns the data
+     * @throws T if an error occurs
      */
     public byte[] updateForce() throws T {
@@ -135,4 +142,5 @@
      * Executes an update regardless of updateInterval
      * @return Returns the data as String
+     * @throws T if an error occurs
      */
     public String updateForceString() throws T {
@@ -144,4 +152,5 @@
      * Returns the data without performing any updates
      * @return the data
+     * @throws T if an error occurs
      */
     public byte[] getData() throws T {
@@ -155,4 +164,5 @@
      * Returns the data without performing any updates
      * @return the data as String
+     * @throws T if an error occurs
      */
     public String getDataString() throws T {
@@ -170,5 +180,7 @@
         try (BufferedInputStream input = new BufferedInputStream(new FileInputStream(path))) {
             this.data = new byte[input.available()];
-            input.read(this.data);
+            if (input.read(this.data) < this.data.length) {
+                Main.error("Failed to read expected contents from "+path);
+            }
         } catch (IOException e) {
             if (!isOffline()) {
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java	(revision 8319)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java	(revision 8332)
@@ -15,4 +15,5 @@
 import java.util.HashSet;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 
@@ -94,5 +95,5 @@
 
         private String getToolTip() {
-            StringBuilder sb=new StringBuilder();
+            StringBuilder sb = new StringBuilder();
             sb.append("<html>");
             sb.append(tr("Old values of"));
@@ -100,14 +101,13 @@
             sb.append(tag);
             sb.append("</b><br/>");
-            for (String k: valueCount.keySet()) {
+            for (Entry<String, Integer> e : valueCount.entrySet()) {
                 sb.append("<b>");
-                sb.append(valueCount.get(k));
+                sb.append(e.getValue());
                 sb.append(" x </b>");
-                sb.append(k);
+                sb.append(e.getKey());
                 sb.append("<br/>");
             }
             sb.append("</html>");
             return sb.toString();
-
         }
     }
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java	(revision 8319)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java	(revision 8332)
@@ -12,4 +12,5 @@
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import org.openstreetmap.josm.Main;
@@ -119,5 +120,5 @@
      * Find the node with almost the same ccords in dataset or in already added nodes
      * @since 5845
-     **/
+     */
     Node findOrCreateNode(LatLon ll,  List<Command> commands) {
         Node nd = null;
@@ -132,7 +133,8 @@
 
         Node prev = null;
-        for (LatLon lOld: addedNodes.keySet()) {
+        for (Entry<LatLon, Node> entry : addedNodes.entrySet()) {
+            LatLon lOld = entry.getKey();
             if (lOld.greatCircleDistance(ll) < Main.pref.getDouble("remotecontrol.tolerance", 0.1)) {
-                prev = addedNodes.get(lOld);
+                prev = entry.getValue();
                 break;
             }
Index: trunk/src/org/openstreetmap/josm/io/session/SessionReader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/session/SessionReader.java	(revision 8319)
+++ trunk/src/org/openstreetmap/josm/io/session/SessionReader.java	(revision 8332)
@@ -484,10 +484,10 @@
 
         layers = new ArrayList<>();
-        for (int idx : layersMap.keySet()) {
-            Layer layer = layersMap.get(idx);
+        for (Entry<Integer, Layer> entry : layersMap.entrySet()) {
+            Layer layer = entry.getValue();
             if (layer == null) {
                 continue;
             }
-            Element el = elems.get(idx);
+            Element el = elems.get(entry.getKey());
             if (el.hasAttribute("visible")) {
                 layer.setVisible(Boolean.parseBoolean(el.getAttribute("visible")));
