Index: /trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java	(revision 10216)
@@ -234,85 +234,105 @@
         switch (mode) {
         case "problem":
-            TestError error = Main.map.validatorDialog.getSelectedError();
-            if (error == null)
-                return null;
-            ((ValidatorBoundingXYVisitor) v).visit(error);
-            if (v.getBounds() == null)
-                return null;
-            v.enlargeBoundingBox(Main.pref.getDouble("validator.zoom-enlarge-bbox", 0.0002));
-            break;
+            return modeProblem(v);
         case "data":
-            for (Layer l : Main.map.mapView.getAllLayers()) {
-                l.visitBoundingBox(v);
-            }
-            break;
+            return modeData(v);
         case "layer":
-            // try to zoom to the first selected layer
-            Layer l = getFirstSelectedLayer();
-            if (l == null)
-                return null;
-            l.visitBoundingBox(v);
-            break;
+            return modeLayer(v);
         case "selection":
         case "conflict":
-            Collection<OsmPrimitive> sel = new HashSet<>();
-            if ("selection".equals(mode)) {
-                sel = getCurrentDataSet().getSelected();
+            return modeSelectionOrConflict(v);
+        case "download":
+            return modeDownload(v);
+        default:
+            return v;
+        }
+    }
+
+    private static BoundingXYVisitor modeProblem(BoundingXYVisitor v) {
+        TestError error = Main.map.validatorDialog.getSelectedError();
+        if (error == null)
+            return null;
+        ((ValidatorBoundingXYVisitor) v).visit(error);
+        if (v.getBounds() == null)
+            return null;
+        v.enlargeBoundingBox(Main.pref.getDouble("validator.zoom-enlarge-bbox", 0.0002));
+        return v;
+    }
+
+    private static BoundingXYVisitor modeData(BoundingXYVisitor v) {
+        for (Layer l : Main.map.mapView.getAllLayers()) {
+            l.visitBoundingBox(v);
+        }
+        return v;
+    }
+
+    private BoundingXYVisitor modeLayer(BoundingXYVisitor v) {
+        // try to zoom to the first selected layer
+        Layer l = getFirstSelectedLayer();
+        if (l == null)
+            return null;
+        l.visitBoundingBox(v);
+        return v;
+    }
+
+    private BoundingXYVisitor modeSelectionOrConflict(BoundingXYVisitor v) {
+        Collection<OsmPrimitive> sel = new HashSet<>();
+        if ("selection".equals(mode)) {
+            sel = getCurrentDataSet().getSelected();
+        } else {
+            Conflict<? extends OsmPrimitive> c = Main.map.conflictDialog.getSelectedConflict();
+            if (c != null) {
+                sel.add(c.getMy());
+            } else if (Main.map.conflictDialog.getConflicts() != null) {
+                sel = Main.map.conflictDialog.getConflicts().getMyConflictParties();
+            }
+        }
+        if (sel.isEmpty()) {
+            JOptionPane.showMessageDialog(
+                    Main.parent,
+                    "selection".equals(mode) ? tr("Nothing selected to zoom to.") : tr("No conflicts to zoom to"),
+                    tr("Information"),
+                    JOptionPane.INFORMATION_MESSAGE);
+            return null;
+        }
+        for (OsmPrimitive osm : sel) {
+            osm.accept(v);
+        }
+
+        // Increase the bounding box by up to 100% to give more context.
+        v.enlargeBoundingBoxLogarithmically(100);
+        // Make the bounding box at least 100 meter wide to
+        // ensure reasonable zoom level when zooming onto single nodes.
+        v.enlargeToMinSize(Main.pref.getDouble("zoom_to_selection_min_size_in_meter", 100));
+        return v;
+    }
+
+    private BoundingXYVisitor modeDownload(BoundingXYVisitor v) {
+        if (lastZoomTime > 0 && System.currentTimeMillis() - lastZoomTime > Main.pref.getLong("zoom.bounds.reset.time", 10L*1000L)) {
+            lastZoomTime = -1;
+        }
+        final DataSet dataset = getCurrentDataSet();
+        if (dataset != null) {
+            List<DataSource> dataSources = new ArrayList<>(dataset.getDataSources());
+            int s = dataSources.size();
+            if (s > 0) {
+                if (lastZoomTime == -1 || lastZoomArea == -1 || lastZoomArea > s) {
+                    lastZoomArea = s-1;
+                    v.visit(dataSources.get(lastZoomArea).bounds);
+                } else if (lastZoomArea > 0) {
+                    lastZoomArea -= 1;
+                    v.visit(dataSources.get(lastZoomArea).bounds);
+                } else {
+                    lastZoomArea = -1;
+                    Area sourceArea = Main.main.getCurrentDataSet().getDataSourceArea();
+                    if (sourceArea != null) {
+                        v.visit(new Bounds(sourceArea.getBounds2D()));
+                    }
+                }
+                lastZoomTime = System.currentTimeMillis();
             } else {
-                Conflict<? extends OsmPrimitive> c = Main.map.conflictDialog.getSelectedConflict();
-                if (c != null) {
-                    sel.add(c.getMy());
-                } else if (Main.map.conflictDialog.getConflicts() != null) {
-                    sel = Main.map.conflictDialog.getConflicts().getMyConflictParties();
-                }
+                lastZoomTime = -1;
+                lastZoomArea = -1;
             }
-            if (sel.isEmpty()) {
-                JOptionPane.showMessageDialog(
-                        Main.parent,
-                        "selection".equals(mode) ? tr("Nothing selected to zoom to.") : tr("No conflicts to zoom to"),
-                        tr("Information"),
-                        JOptionPane.INFORMATION_MESSAGE);
-                return null;
-            }
-            for (OsmPrimitive osm : sel) {
-                osm.accept(v);
-            }
-
-            // Increase the bounding box by up to 100% to give more context.
-            v.enlargeBoundingBoxLogarithmically(100);
-            // Make the bounding box at least 100 meter wide to
-            // ensure reasonable zoom level when zooming onto single nodes.
-            v.enlargeToMinSize(Main.pref.getDouble("zoom_to_selection_min_size_in_meter", 100));
-            break;
-        case "download":
-
-            if (lastZoomTime > 0 && System.currentTimeMillis() - lastZoomTime > Main.pref.getLong("zoom.bounds.reset.time", 10L*1000L)) {
-                lastZoomTime = -1;
-            }
-            final DataSet dataset = getCurrentDataSet();
-            if (dataset != null) {
-                List<DataSource> dataSources = new ArrayList<>(dataset.getDataSources());
-                int s = dataSources.size();
-                if (s > 0) {
-                    if (lastZoomTime == -1 || lastZoomArea == -1 || lastZoomArea > s) {
-                        lastZoomArea = s-1;
-                        v.visit(dataSources.get(lastZoomArea).bounds);
-                    } else if (lastZoomArea > 0) {
-                        lastZoomArea -= 1;
-                        v.visit(dataSources.get(lastZoomArea).bounds);
-                    } else {
-                        lastZoomArea = -1;
-                        Area sourceArea = Main.main.getCurrentDataSet().getDataSourceArea();
-                        if (sourceArea != null) {
-                            v.visit(new Bounds(sourceArea.getBounds2D()));
-                        }
-                    }
-                    lastZoomTime = System.currentTimeMillis();
-                } else {
-                    lastZoomTime = -1;
-                    lastZoomArea = -1;
-                }
-            }
-            break;
         }
         return v;
Index: /trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java	(revision 10216)
@@ -118,5 +118,6 @@
         }
         KeyEvent kev = (KeyEvent) event;
-        int dx = 0, dy = 0;
+        int dx = 0;
+        int dy = 0;
         switch (kev.getKeyCode()) {
         case KeyEvent.VK_UP : dy = +1; break;
@@ -124,4 +125,5 @@
         case KeyEvent.VK_LEFT : dx = -1; break;
         case KeyEvent.VK_RIGHT : dx = +1; break;
+        default: // Do nothing
         }
         if (dx != 0 || dy != 0) {
Index: /trunk/src/org/openstreetmap/josm/actions/PasteAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/PasteAction.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/actions/PasteAction.java	(revision 10216)
@@ -64,5 +64,8 @@
     public void pasteData(PrimitiveDeepCopy pasteBuffer, Layer source, ActionEvent e) {
         /* Find the middle of the pasteBuffer area */
-        double maxEast = -1E100, minEast = 1E100, maxNorth = -1E100, minNorth = 1E100;
+        double maxEast = -1E100;
+        double minEast = 1E100;
+        double maxNorth = -1E100;
+        double minNorth = 1E100;
         boolean incomplete = false;
         for (PrimitiveData data : pasteBuffer.getAll()) {
@@ -92,6 +95,6 @@
 
         // Allow to cancel paste if there are incomplete primitives
-        if (incomplete) {
-            if (!confirmDeleteIncomplete()) return;
+        if (incomplete && !confirmDeleteIncomplete()) {
+            return;
         }
 
@@ -158,5 +161,5 @@
                 for (RelationMemberData member: ((RelationData) data).getMembers()) {
                     OsmPrimitiveType memberType = member.getMemberType();
-                    Long newId = null;
+                    Long newId;
                     switch (memberType) {
                     case NODE:
@@ -169,4 +172,5 @@
                         newId = newRelationIds.get(member.getMemberId());
                         break;
+                    default: throw new AssertionError();
                     }
                     if (newId != null) {
@@ -183,5 +187,5 @@
     }
 
-    protected boolean confirmDeleteIncomplete() {
+    private static boolean confirmDeleteIncomplete() {
         ExtendedDialog ed = new ExtendedDialog(Main.parent,
                 tr("Delete incomplete members?"),
Index: /trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java	(revision 10216)
@@ -135,5 +135,4 @@
             }
         } catch (SecurityException e) {
-            // Ignore exception
             if (Main.isTraceEnabled()) {
                 Main.trace(e.getMessage());
@@ -165,5 +164,5 @@
     }
 
-    protected static Collection<String> getCustomUrls(SourceEditor.SourcePrefHelper helper) {
+    private static Collection<String> getCustomUrls(SourceEditor.SourcePrefHelper helper) {
         Set<String> set = new TreeSet<>();
         for (SourceEntry entry : helper.get()) {
@@ -221,5 +220,5 @@
     }
 
-    protected static <T> void appendCollection(StringBuilder text, String label, Collection<T> col) {
+    private static <T> void appendCollection(StringBuilder text, String label, Collection<T> col) {
         if (!col.isEmpty()) {
             text.append(label+":\n");
@@ -267,4 +266,5 @@
             case 1: ta.copyToClippboard(); break;
             case 2: BugReportSender.reportBug(reportHeader); break;
+            default: // Do nothing
         }
     }
Index: /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTask.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTask.java	(revision 10216)
@@ -184,9 +184,10 @@
                 if (canceled)
                     return;
-                String msg = "";
+                String msg;
                 switch(entry.getValue()) {
                 case NODE: msg = tr("({0}/{1}) Loading parents of node {2}", i+1, children.size(), entry.getKey()); break;
                 case WAY: msg = tr("({0}/{1}) Loading parents of way {2}", i+1, children.size(), entry.getKey()); break;
                 case RELATION: msg = tr("({0}/{1}) Loading parents of relation {2}", i+1, children.size(), entry.getKey()); break;
+                default: throw new AssertionError();
                 }
                 progressMonitor.subTask(msg);
Index: /trunk/src/org/openstreetmap/josm/command/ChangeCommand.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/command/ChangeCommand.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/command/ChangeCommand.java	(revision 10216)
@@ -76,9 +76,10 @@
     @Override
     public String getDescriptionText() {
-        String msg = "";
+        String msg;
         switch(OsmPrimitiveType.from(osm)) {
         case NODE: msg = marktr("Change node {0}"); break;
         case WAY: msg = marktr("Change way {0}"); break;
         case RELATION: msg = marktr("Change relation {0}"); break;
+        default: throw new AssertionError();
         }
         return tr(msg, osm.getDisplayName(DefaultNameFormatter.getInstance()));
Index: /trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java	(revision 10216)
@@ -161,4 +161,5 @@
                 case WAY: msg = marktr("Remove \"{0}\" for way ''{1}''"); break;
                 case RELATION: msg = marktr("Remove \"{0}\" for relation ''{1}''"); break;
+                default: throw new AssertionError();
                 }
                 text = tr(msg, entry.getKey(), primitive.getDisplayName(DefaultNameFormatter.getInstance()));
@@ -168,4 +169,5 @@
                 case WAY: msg = marktr("Set {0}={1} for way ''{2}''"); break;
                 case RELATION: msg = marktr("Set {0}={1} for relation ''{2}''"); break;
+                default: throw new AssertionError();
                 }
                 text = tr(msg, entry.getKey(), entry.getValue(), primitive.getDisplayName(DefaultNameFormatter.getInstance()));
Index: /trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/command/DeleteCommand.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/command/DeleteCommand.java	(revision 10216)
@@ -160,6 +160,6 @@
     }
 
-    private Set<OsmPrimitiveType> getTypesToDelete() {
-        Set<OsmPrimitiveType> typesToDelete = EnumSet.noneOf(OsmPrimitiveType.class);
+    private EnumSet<OsmPrimitiveType> getTypesToDelete() {
+        EnumSet<OsmPrimitiveType> typesToDelete = EnumSet.noneOf(OsmPrimitiveType.class);
         for (OsmPrimitive osm : toDelete) {
             typesToDelete.add(OsmPrimitiveType.from(osm));
@@ -172,9 +172,10 @@
         if (toDelete.size() == 1) {
             OsmPrimitive primitive = toDelete.iterator().next();
-            String msg = "";
+            String msg;
             switch(OsmPrimitiveType.from(primitive)) {
             case NODE: msg = marktr("Delete node {0}"); break;
             case WAY: msg = marktr("Delete way {0}"); break;
             case RELATION:msg = marktr("Delete relation {0}"); break;
+            default: throw new AssertionError();
             }
 
@@ -182,5 +183,5 @@
         } else {
             Set<OsmPrimitiveType> typesToDelete = getTypesToDelete();
-            String msg = "";
+            String msg;
             if (typesToDelete.size() > 1) {
                 msg = trn("Delete {0} object", "Delete {0} objects", toDelete.size(), toDelete.size());
@@ -191,4 +192,5 @@
                 case WAY: msg = trn("Delete {0} way", "Delete {0} ways", toDelete.size(), toDelete.size()); break;
                 case RELATION: msg = trn("Delete {0} relation", "Delete {0} relations", toDelete.size(), toDelete.size()); break;
+                default: throw new AssertionError();
                 }
             }
Index: /trunk/src/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommand.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommand.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommand.java	(revision 10216)
@@ -17,6 +17,5 @@
 /**
  * Represents the resolution of a conflict between the modified flag of two {@link OsmPrimitive}s.
- *
- *
+ * @since 2624
  */
 public class ModifiedConflictResolveCommand extends ConflictResolveCommand {
@@ -35,9 +34,10 @@
     @Override
     public String getDescriptionText() {
-        String msg = "";
+        String msg;
         switch(OsmPrimitiveType.from(conflict.getMy())) {
         case NODE: msg = marktr("Set the ''modified'' flag for node {0}"); break;
         case WAY: msg = marktr("Set the ''modified'' flag for way {0}"); break;
         case RELATION: msg = marktr("Set the ''modified'' flag for relation {0}"); break;
+        default: throw new AssertionError();
         }
         return tr(msg, conflict.getMy().getId());
Index: /trunk/src/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommand.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommand.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommand.java	(revision 10216)
@@ -17,6 +17,5 @@
 /**
  * Represents the resolution of a version conflict between two {@link OsmPrimitive}s.
- *
- *
+ * @since 1622
  */
 public class VersionConflictResolveCommand extends ConflictResolveCommand {
@@ -35,9 +34,10 @@
     @Override
     public String getDescriptionText() {
-        String msg = "";
+        String msg;
         switch(OsmPrimitiveType.from(conflict.getMy())) {
         case NODE: msg = marktr("Resolve version conflict for node {0}"); break;
         case WAY: msg = marktr("Resolve version conflict for way {0}"); break;
         case RELATION: msg = marktr("Resolve version conflict for relation {0}"); break;
+        default: throw new AssertionError();
         }
         return tr(msg, conflict.getMy().getId());
Index: /trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java	(revision 10216)
@@ -192,7 +192,6 @@
      */
     public static void messageBox(String type, String text) {
-        if (type == null || type.isEmpty()) type = "plain";
-
-        switch (type.charAt(0)) {
+        char c = (type == null || type.isEmpty() ? "plain" : type).charAt(0);
+        switch (c) {
             case 'i': JOptionPane.showMessageDialog(Main.parent, text, tr("Information"), JOptionPane.INFORMATION_MESSAGE); break;
             case 'w': JOptionPane.showMessageDialog(Main.parent, text, tr("Warning"), JOptionPane.WARNING_MESSAGE); break;
@@ -200,4 +199,5 @@
             case 'q': JOptionPane.showMessageDialog(Main.parent, text, tr("Question"), JOptionPane.QUESTION_MESSAGE); break;
             case 'p': JOptionPane.showMessageDialog(Main.parent, text, tr("Message"), JOptionPane.PLAIN_MESSAGE); break;
+            default: Main.warn("Unsupported messageBox type: " + c);
         }
     }
Index: /trunk/src/org/openstreetmap/josm/data/osm/RelationMemberData.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/RelationMemberData.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/data/osm/RelationMemberData.java	(revision 10216)
@@ -4,4 +4,6 @@
 import java.io.Serializable;
 import java.util.Objects;
+
+import org.openstreetmap.josm.tools.CheckParameterUtil;
 
 public class RelationMemberData implements PrimitiveId, Serializable {
@@ -12,5 +14,13 @@
     private final OsmPrimitiveType memberType;
 
+    /**
+     * Constructs a new {@code RelationMemberData}.
+     * @param role member role - can be null
+     * @param type member type - cannot be null
+     * @param id member id - cannot be null
+     * @throws IllegalArgumentException is type or id is null
+     */
     public RelationMemberData(String role, OsmPrimitiveType type, long id) {
+        CheckParameterUtil.ensureParameterNotNull(type, "type");
         this.role = role == null ? "" : role;
         this.memberType = type;
@@ -18,20 +28,42 @@
     }
 
+    /**
+     * Constructs a new {@code RelationMemberData}.
+     * @param role member role - can be null
+     * @param primitive member type and id - cannot be null
+     * @throws NullPointerException if primitive is null
+     */
     public RelationMemberData(String role, PrimitiveId primitive) {
         this(role, primitive.getType(), primitive.getUniqueId());
     }
 
+    /**
+     * Get member id.
+     * @return member id
+     */
     public long getMemberId() {
         return memberId;
     }
 
+    /**
+     * Get member role.
+     * @return member role
+     */
     public String getRole() {
         return role;
     }
 
+    /**
+     * Get member type.
+     * @return member type
+     */
     public OsmPrimitiveType getMemberType() {
         return memberType;
     }
 
+    /**
+     * Determines if this member has a role.
+     * @return {@code true} if this member has a role
+     */
     public boolean hasRole() {
         return !"".equals(role);
Index: /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java	(revision 10216)
@@ -1091,4 +1091,6 @@
                             via = w;
                         }
+                        break;
+                    default: // Do nothing
                     }
                 } else if (m.isNode()) {
Index: /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java	(revision 10216)
@@ -264,4 +264,6 @@
                         }
                         total++;
+                        break;
+                    default: // Do nothing
                 }
             }
Index: /trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java	(revision 10216)
@@ -211,4 +211,7 @@
                         case "K:":
                             ignoreDataTag.add(Tag.ofString(line));
+                            break;
+                        default:
+                            Main.warn("Unsupported TagChecker key: " + key);
                         }
                     } else if (tagcheckerfile) {
Index: /trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListTableCellRenderer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListTableCellRenderer.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListTableCellRenderer.java	(revision 10216)
@@ -4,5 +4,4 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
-import java.awt.Color;
 import java.awt.Component;
 import java.util.EnumMap;
@@ -48,18 +47,14 @@
 
     protected void renderRole(Item diffItem) {
-        String text = "";
-        Color bgColor = diffItem.state.getColor();
         RelationMemberData member = (RelationMemberData) diffItem.value;
-        text = member == null ? "" : member.getRole();
+        String text = member == null ? "" : member.getRole();
         setText(text);
         setToolTipText(text);
-        GuiHelper.setBackgroundReadable(this, bgColor);
+        GuiHelper.setBackgroundReadable(this, diffItem.state.getColor());
     }
 
     protected void renderPrimitive(Item diffItem) {
         String text = "";
-        Color bgColor = diffItem.state.getColor();
         RelationMemberData member = (RelationMemberData) diffItem.value;
-        text = "";
         if (member != null) {
             switch(member.getMemberType()) {
@@ -67,9 +62,10 @@
             case WAY: text = tr("Way {0}", member.getMemberId()); break;
             case RELATION: text = tr("Relation {0}", member.getMemberId()); break;
+            default: throw new AssertionError();
             }
         }
         setText(text);
         setToolTipText(text);
-        GuiHelper.setBackgroundReadable(this, bgColor);
+        GuiHelper.setBackgroundReadable(this, diffItem.state.getColor());
     }
 
@@ -89,4 +85,5 @@
             renderPrimitive(member);
             break;
+        default: // Do nothing
         }
 
Index: /trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java	(revision 10216)
@@ -400,5 +400,5 @@
             else if (dates.length == 2)
                 return new Date[]{parseDate(dates[0], "time"), parseDate(dates[1], "time")};
-            return null;
+            return new Date[]{};
         }
 
@@ -447,4 +447,6 @@
                         csQuery.closedAfterAndCreatedBefore(dates[0], dates[1]);
                         break;
+                    default:
+                        Main.warn("Unable to parse time: " + entry.getValue());
                     }
                     break;
Index: /trunk/src/org/openstreetmap/josm/io/GpxReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/GpxReader.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/io/GpxReader.java	(revision 10216)
@@ -45,15 +45,15 @@
 
     private enum State {
-        init,
-        gpx,
-        metadata,
-        wpt,
-        rte,
-        trk,
-        ext,
-        author,
-        link,
-        trkseg,
-        copyright
+        INIT,
+        GPX,
+        METADATA,
+        WPT,
+        RTE,
+        TRK,
+        EXT,
+        AUTHOR,
+        LINK,
+        TRKSEG,
+        COPYRIGHT
     }
 
@@ -72,5 +72,5 @@
         private WayPoint currentWayPoint;
 
-        private State currentState = State.init;
+        private State currentState = State.INIT;
 
         private GpxLink currentLink;
@@ -108,7 +108,7 @@
             elements.push(localName);
             switch(currentState) {
-            case init:
+            case INIT:
                 states.push(currentState);
-                currentState = State.gpx;
+                currentState = State.GPX;
                 data.creator = atts.getValue("creator");
                 version = atts.getValue("version");
@@ -120,23 +120,23 @@
                 }
                 break;
-            case gpx:
+            case GPX:
                 switch (localName) {
                 case "metadata":
                     states.push(currentState);
-                    currentState = State.metadata;
+                    currentState = State.METADATA;
                     break;
                 case "wpt":
                     states.push(currentState);
-                    currentState = State.wpt;
+                    currentState = State.WPT;
                     currentWayPoint = new WayPoint(parseLatLon(atts));
                     break;
                 case "rte":
                     states.push(currentState);
-                    currentState = State.rte;
+                    currentState = State.RTE;
                     currentRoute = new GpxRoute();
                     break;
                 case "trk":
                     states.push(currentState);
-                    currentState = State.trk;
+                    currentState = State.TRK;
                     currentTrack = new ArrayList<>();
                     currentTrackAttr = new HashMap<>();
@@ -144,5 +144,5 @@
                 case "extensions":
                     states.push(currentState);
-                    currentState = State.ext;
+                    currentState = State.EXT;
                     currentExtensions = new Extensions();
                     break;
@@ -151,25 +151,27 @@
                         nokiaSportsTrackerBug = true;
                     }
-                }
-                break;
-            case metadata:
+                    break;
+                default: // Do nothing
+                }
+                break;
+            case METADATA:
                 switch (localName) {
                 case "author":
                     states.push(currentState);
-                    currentState = State.author;
+                    currentState = State.AUTHOR;
                     break;
                 case "extensions":
                     states.push(currentState);
-                    currentState = State.ext;
+                    currentState = State.EXT;
                     currentExtensions = new Extensions();
                     break;
                 case "copyright":
                     states.push(currentState);
-                    currentState = State.copyright;
+                    currentState = State.COPYRIGHT;
                     data.put(META_COPYRIGHT_AUTHOR, atts.getValue("author"));
                     break;
                 case "link":
                     states.push(currentState);
-                    currentState = State.link;
+                    currentState = State.LINK;
                     currentLink = new GpxLink(atts.getValue("href"));
                     break;
@@ -180,75 +182,84 @@
                                 parseCoord(atts.getValue("maxlat")),
                                 parseCoord(atts.getValue("maxlon"))));
-                }
-                break;
-            case author:
-                switch (localName) {
-                case "link":
-                    states.push(currentState);
-                    currentState = State.link;
+                    break;
+                default: // Do nothing
+                }
+                break;
+            case AUTHOR:
+                switch (localName) {
+                case "link":
+                    states.push(currentState);
+                    currentState = State.LINK;
                     currentLink = new GpxLink(atts.getValue("href"));
                     break;
                 case "email":
                     data.put(META_AUTHOR_EMAIL, atts.getValue("id") + '@' + atts.getValue("domain"));
-                }
-                break;
-            case trk:
+                    break;
+                default: // Do nothing
+                }
+                break;
+            case TRK:
                 switch (localName) {
                 case "trkseg":
                     states.push(currentState);
-                    currentState = State.trkseg;
+                    currentState = State.TRKSEG;
                     currentTrackSeg = new ArrayList<>();
                     break;
                 case "link":
                     states.push(currentState);
-                    currentState = State.link;
+                    currentState = State.LINK;
                     currentLink = new GpxLink(atts.getValue("href"));
                     break;
                 case "extensions":
                     states.push(currentState);
-                    currentState = State.ext;
+                    currentState = State.EXT;
                     currentExtensions = new Extensions();
-                }
-                break;
-            case trkseg:
+                    break;
+                default: // Do nothing
+                }
+                break;
+            case TRKSEG:
                 if ("trkpt".equals(localName)) {
                     states.push(currentState);
-                    currentState = State.wpt;
+                    currentState = State.WPT;
                     currentWayPoint = new WayPoint(parseLatLon(atts));
                 }
                 break;
-            case wpt:
-                switch (localName) {
-                case "link":
-                    states.push(currentState);
-                    currentState = State.link;
+            case WPT:
+                switch (localName) {
+                case "link":
+                    states.push(currentState);
+                    currentState = State.LINK;
                     currentLink = new GpxLink(atts.getValue("href"));
                     break;
                 case "extensions":
                     states.push(currentState);
-                    currentState = State.ext;
+                    currentState = State.EXT;
                     currentExtensions = new Extensions();
                     break;
-                }
-                break;
-            case rte:
-                switch (localName) {
-                case "link":
-                    states.push(currentState);
-                    currentState = State.link;
+                default: // Do nothing
+                }
+                break;
+            case RTE:
+                switch (localName) {
+                case "link":
+                    states.push(currentState);
+                    currentState = State.LINK;
                     currentLink = new GpxLink(atts.getValue("href"));
                     break;
                 case "rtept":
                     states.push(currentState);
-                    currentState = State.wpt;
+                    currentState = State.WPT;
                     currentWayPoint = new WayPoint(parseLatLon(atts));
                     break;
                 case "extensions":
                     states.push(currentState);
-                    currentState = State.ext;
+                    currentState = State.EXT;
                     currentExtensions = new Extensions();
                     break;
-                }
-                break;
+                default: // Do nothing
+                }
+                break;
+            default: // Do nothing
             }
             accumulator.setLength(0);
@@ -276,8 +287,8 @@
         private Map<String, Object> getAttr() {
             switch (currentState) {
-            case rte: return currentRoute.attr;
-            case metadata: return data.attr;
-            case wpt: return currentWayPoint.attr;
-            case trk: return currentTrackAttr;
+            case RTE: return currentRoute.attr;
+            case METADATA: return data.attr;
+            case WPT: return currentWayPoint.attr;
+            case TRK: return currentTrackAttr;
             default: return null;
             }
@@ -289,6 +300,6 @@
             elements.pop();
             switch (currentState) {
-            case gpx:       // GPX 1.0
-            case metadata:  // GPX 1.1
+            case GPX:       // GPX 1.0
+            case METADATA:  // GPX 1.1
                 switch (localName) {
                 case "name":
@@ -321,6 +332,6 @@
                 case "metadata":
                 case "gpx":
-                    if ((currentState == State.metadata && "metadata".equals(localName)) ||
-                        (currentState == State.gpx && "gpx".equals(localName))) {
+                    if ((currentState == State.METADATA && "metadata".equals(localName)) ||
+                        (currentState == State.GPX && "gpx".equals(localName))) {
                         convertUrlToLink(data.attr);
                         if (currentExtensions != null && !currentExtensions.isEmpty()) {
@@ -337,5 +348,5 @@
                 }
                 break;
-            case author:
+            case AUTHOR:
                 switch (localName) {
                 case "author":
@@ -351,7 +362,8 @@
                     data.put(META_AUTHOR_LINK, currentLink);
                     break;
-                }
-                break;
-            case copyright:
+                default: // Do nothing
+                }
+                break;
+            case COPYRIGHT:
                 switch (localName) {
                 case "copyright":
@@ -364,7 +376,8 @@
                     data.put(META_COPYRIGHT_LICENSE, accumulator.toString());
                     break;
-                }
-                break;
-            case link:
+                default: // Do nothing
+                }
+                break;
+            case LINK:
                 switch (localName) {
                 case "text":
@@ -380,8 +393,9 @@
                     currentState = states.pop();
                     break;
-                }
-                if (currentState == State.author) {
+                default: // Do nothing
+                }
+                if (currentState == State.AUTHOR) {
                     data.put(META_AUTHOR_LINK, currentLink);
-                } else if (currentState != State.link) {
+                } else if (currentState != State.LINK) {
                     Map<String, Object> attr = getAttr();
                     if (!attr.containsKey(META_LINKS)) {
@@ -391,5 +405,5 @@
                 }
                 break;
-            case wpt:
+            case WPT:
                 switch (localName) {
                 case "ele":
@@ -437,7 +451,8 @@
                     data.waypoints.add(currentWayPoint);
                     break;
-                }
-                break;
-            case trkseg:
+                default: // Do nothing
+                }
+                break;
+            case TRKSEG:
                 if ("trkseg".equals(localName)) {
                     currentState = states.pop();
@@ -445,5 +460,5 @@
                 }
                 break;
-            case trk:
+            case TRK:
                 switch (localName) {
                 case "trk":
@@ -462,7 +477,8 @@
                     currentTrackAttr.put(localName, accumulator.toString());
                     break;
-                }
-                break;
-            case ext:
+                default: // Do nothing
+                }
+                break;
+            case EXT:
                 if ("extensions".equals(localName)) {
                     currentState = states.pop();
@@ -482,4 +498,5 @@
                     data.routes.add(currentRoute);
                     break;
+                default: // Do nothing
                 }
             }
@@ -516,5 +533,5 @@
         }
 
-        public void tryToFinish() throws SAXException {
+        void tryToFinish() throws SAXException {
             List<String> remainingElements = new ArrayList<>(elements);
             for (int i = remainingElements.size() - 1; i >= 0; i--) {
Index: /trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java	(revision 10216)
@@ -125,4 +125,5 @@
         case WAY: ways.add(id.getUniqueId()); break;
         case RELATION: relations.add(id.getUniqueId()); break;
+        default: throw new AssertionError();
         }
     }
@@ -580,9 +581,10 @@
             for (long id : pkg) {
                 try {
-                    String msg = "";
+                    String msg;
                     switch (type) {
                         case NODE:     msg = tr("Fetching node with id {0} from ''{1}''",     id, baseUrl); break;
                         case WAY:      msg = tr("Fetching way with id {0} from ''{1}''",      id, baseUrl); break;
                         case RELATION: msg = tr("Fetching relation with id {0} from ''{1}''", id, baseUrl); break;
+                        default: throw new AssertionError();
                     }
                     progressMonitor.setCustomText(msg);
Index: /trunk/src/org/openstreetmap/josm/io/NoteReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/NoteReader.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/io/NoteReader.java	(revision 10216)
@@ -126,4 +126,5 @@
                 }
                 break;
+            default: // Do nothing
             }
         }
Index: /trunk/src/org/openstreetmap/josm/io/OsmApiPrimitiveGoneException.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmApiPrimitiveGoneException.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/io/OsmApiPrimitiveGoneException.java	(revision 10216)
@@ -11,5 +11,5 @@
  * Represents an exception thrown by the OSM API if JOSM tries to update or delete a primitive
  * which is already deleted on the server.
- *
+ * @since 2198
  */
 public class OsmApiPrimitiveGoneException extends OsmApiException {
@@ -19,16 +19,27 @@
     public static final String ERROR_HEADER_PATTERN = "The (\\S+) with the id (\\d+) has already been deleted";
     /** the type of the primitive which is gone on the server */
-    private OsmPrimitiveType type;
+    private final OsmPrimitiveType type;
     /** the id of the primitive */
-    private long id;
+    private final long id;
 
+    /**
+     * Constructs a new {@code OsmApiPrimitiveGoneException}.
+     * @param errorHeader error header
+     * @param errorBody error body
+     */
     public OsmApiPrimitiveGoneException(String errorHeader, String errorBody) {
         super(HttpURLConnection.HTTP_GONE, errorHeader, errorBody);
-        if (errorHeader == null) return;
-        Pattern p = Pattern.compile(ERROR_HEADER_PATTERN);
-        Matcher m = p.matcher(errorHeader);
-        if (m.matches()) {
-            type = OsmPrimitiveType.from(m.group(1));
-            id = Long.parseLong(m.group(2));
+        if (errorHeader != null) {
+            Matcher m = Pattern.compile(ERROR_HEADER_PATTERN).matcher(errorHeader);
+            if (m.matches()) {
+                type = OsmPrimitiveType.from(m.group(1));
+                id = Long.parseLong(m.group(2));
+            } else {
+                type = null;
+                id = 0;
+            }
+        } else {
+            type = null;
+            id = 0;
         }
     }
Index: /trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java	(revision 10216)
@@ -219,4 +219,5 @@
                 break;
             case CHUNKED_DATASET_STRATEGY:
+            default:
                 uploadChangesInChunks(primitives, monitor.createSubTaskMonitor(0, false), strategy.getChunkSize());
                 break;
Index: /trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java	(revision 10216)
@@ -228,4 +228,5 @@
                 }
                 break;
+            default: // Do nothing
             }
             /**
@@ -433,4 +434,5 @@
                     entry.setEpsg4326To3857Supported(Boolean.valueOf(accumulator.toString()));
                     break;
+                default: // Do nothing
                 }
                 break;
Index: /trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java	(revision 10216)
@@ -55,12 +55,24 @@
     private List<String> formats;
 
+    /**
+     * Returns the list of layers.
+     * @return the list of layers
+     */
     public List<LayerDetails> getLayers() {
         return layers;
     }
 
+    /**
+     * Returns the service URL.
+     * @return the service URL
+     */
     public URL getServiceUrl() {
         return serviceUrl;
     }
 
+    /**
+     * Returns the list of supported formats.
+     * @return the list of supported formats
+     */
     public List<String> getFormats() {
         return Collections.unmodifiableList(formats);
@@ -311,4 +323,5 @@
                     content.append(node.getNodeValue());
                     break;
+                default: // Do nothing
             }
         }
@@ -371,5 +384,4 @@
                 return this.name;
         }
-
     }
 }
Index: /trunk/src/org/openstreetmap/josm/io/session/GeoImageSessionImporter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/session/GeoImageSessionImporter.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/io/session/GeoImageSessionImporter.java	(revision 10216)
@@ -49,53 +49,5 @@
                         Node attrNode = attrNodes.item(j);
                         if (attrNode.getNodeType() == Node.ELEMENT_NODE) {
-                            Element attrElem = (Element) attrNode;
-                            try {
-                                switch(attrElem.getTagName()) {
-                                case "file":
-                                    entry.setFile(new File(attrElem.getTextContent()));
-                                    break;
-                                case "position":
-                                    double lat = Double.parseDouble(attrElem.getAttribute("lat"));
-                                    double lon = Double.parseDouble(attrElem.getAttribute("lon"));
-                                    entry.setPos(new LatLon(lat, lon));
-                                    break;
-                                case "speed":
-                                    entry.setSpeed(Double.valueOf(attrElem.getTextContent()));
-                                    break;
-                                case "elevation":
-                                    entry.setElevation(Double.valueOf(attrElem.getTextContent()));
-                                    break;
-                                case "gps-time":
-                                    entry.setGpsTime(new Date(Long.parseLong(attrElem.getTextContent())));
-                                    break;
-                                case "exif-orientation":
-                                    entry.setExifOrientation(Integer.valueOf(attrElem.getTextContent()));
-                                    break;
-                                case "exif-time":
-                                    entry.setExifTime(new Date(Long.parseLong(attrElem.getTextContent())));
-                                    break;
-                                case "exif-gps-time":
-                                    entry.setExifGpsTime(new Date(Long.parseLong(attrElem.getTextContent())));
-                                    break;
-                                case "exif-coordinates":
-                                    entry.setExifCoor(new LatLon(
-                                            Double.parseDouble(attrElem.getAttribute("lat")),
-                                            Double.parseDouble(attrElem.getAttribute("lon"))));
-                                    break;
-                                case "exif-image-direction":
-                                    entry.setExifImgDir(Double.parseDouble(attrElem.getTextContent()));
-                                    break;
-                                case "is-new-gps-data":
-                                    if (Boolean.parseBoolean(attrElem.getTextContent())) {
-                                        entry.flagNewGpsData();
-                                    }
-                                }
-                                // TODO: handle thumbnail loading
-                            } catch (NumberFormatException e) {
-                                // do nothing
-                                if (Main.isTraceEnabled()) {
-                                    Main.trace(e.getMessage());
-                                }
-                            }
+                            handleElement(entry, (Element) attrNode);
                         }
                     }
@@ -118,3 +70,55 @@
         return new GeoImageLayer(entries, gpxLayer, useThumbs);
     }
+
+    private static void handleElement(ImageEntry entry, Element attrElem) {
+        try {
+            switch(attrElem.getTagName()) {
+            case "file":
+                entry.setFile(new File(attrElem.getTextContent()));
+                break;
+            case "position":
+                double lat = Double.parseDouble(attrElem.getAttribute("lat"));
+                double lon = Double.parseDouble(attrElem.getAttribute("lon"));
+                entry.setPos(new LatLon(lat, lon));
+                break;
+            case "speed":
+                entry.setSpeed(Double.valueOf(attrElem.getTextContent()));
+                break;
+            case "elevation":
+                entry.setElevation(Double.valueOf(attrElem.getTextContent()));
+                break;
+            case "gps-time":
+                entry.setGpsTime(new Date(Long.parseLong(attrElem.getTextContent())));
+                break;
+            case "exif-orientation":
+                entry.setExifOrientation(Integer.valueOf(attrElem.getTextContent()));
+                break;
+            case "exif-time":
+                entry.setExifTime(new Date(Long.parseLong(attrElem.getTextContent())));
+                break;
+            case "exif-gps-time":
+                entry.setExifGpsTime(new Date(Long.parseLong(attrElem.getTextContent())));
+                break;
+            case "exif-coordinates":
+                entry.setExifCoor(new LatLon(
+                        Double.parseDouble(attrElem.getAttribute("lat")),
+                        Double.parseDouble(attrElem.getAttribute("lon"))));
+                break;
+            case "exif-image-direction":
+                entry.setExifImgDir(Double.parseDouble(attrElem.getTextContent()));
+                break;
+            case "is-new-gps-data":
+                if (Boolean.parseBoolean(attrElem.getTextContent())) {
+                    entry.flagNewGpsData();
+                }
+                break;
+            default: // Do nothing
+            }
+            // TODO: handle thumbnail loading
+        } catch (NumberFormatException e) {
+            if (Main.isTraceEnabled()) {
+                Main.trace(e.getMessage());
+            }
+        }
+    }
 }
Index: /trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 10216)
@@ -451,4 +451,5 @@
                 Main.pref.put(togglePreferenceKey, "never");
                 break;
+            default: // Do nothing
             }
         } else {
Index: /trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java	(revision 10215)
+++ /trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java	(revision 10216)
@@ -286,4 +286,5 @@
                         command.possiblyInterrupt();
                         break;
+                    default: // Do nothing
                 }
             } catch (InterruptedException e) {
@@ -355,4 +356,5 @@
                             stateChange = State.PAUSED;
                             break;
+                        default: // Do nothing
                     }
                     command.ok(stateChange);
