Index: trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/DeleteCommand.java	(revision 7023)
+++ trunk/src/org/openstreetmap/josm/command/DeleteCommand.java	(revision 7024)
@@ -477,5 +477,5 @@
                 relations.size(), relations.size(), DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(relations))
                 + "</html>"));
-        boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog(
+        return ConditionalOptionPaneUtil.showConfirmationDialog(
                 "delete_relations",
                 Main.parent,
@@ -485,5 +485,4 @@
                 JOptionPane.QUESTION_MESSAGE,
                 JOptionPane.YES_OPTION);
-        return answer;
     }
 }
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java	(revision 7023)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java	(revision 7024)
@@ -320,5 +320,5 @@
         PseudoCommand c = ((CommandListMutableTreeNode) path.getLastPathComponent()).getCommand();
         final OsmDataLayer currentLayer = Main.main.getEditLayer();
-        FilteredCollection<OsmPrimitive> prims = new FilteredCollection<>(
+        return new FilteredCollection<>(
                 c.getParticipatingPrimitives(),
                 new Predicate<OsmPrimitive>(){
@@ -330,5 +330,4 @@
                 }
         );
-        return prims;
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java	(revision 7023)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java	(revision 7024)
@@ -1420,5 +1420,5 @@
             };
 
-            int ret = HelpAwareOptionPane.showOptionDialog(
+            return HelpAwareOptionPane.showOptionDialog(
                     Main.parent,
                     tr("<html>The relation has been changed.<br>"
@@ -1432,5 +1432,4 @@
                             "/Dialog/RelationEditor#DiscardChanges"
             );
-            return ret;
         }
     }
Index: trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java	(revision 7023)
+++ trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java	(revision 7024)
@@ -121,6 +121,4 @@
     }
 
-    /*boolean debug = true;*/
-
     public interface TileLoaderFactory {
         OsmTileLoader makeTileLoader(TileLoaderListener listener);
@@ -170,7 +168,7 @@
         Main.map.repaint(100);
         tileRequestsOutstanding.remove(tile);
-        /*if (debug) {
+        if (Main.isDebugEnabled()) {
             Main.debug("tileLoadingFinished() tile: " + tile + " success: " + success);
-        }*/
+        }
     }
 
@@ -639,5 +637,4 @@
             }
         }));
-        // end of adding menu commands
 
         final MouseAdapter adapter = new MouseAdapter() {
@@ -677,7 +674,7 @@
 
     void zoomChanged() {
-        /*if (debug) {
+        if (Main.isDebugEnabled()) {
             Main.debug("zoomChanged(): " + currentZoomLevel);
-        }*/
+        }
         needRedraw = true;
         JobDispatcher.getInstance().cancelOutstandingJobs();
@@ -703,7 +700,7 @@
     public boolean zoomIncreaseAllowed() {
         boolean zia = currentZoomLevel < this.getMaxZoomLvl();
-        /*if (debug) {
+        if (Main.isDebugEnabled()) {
             Main.debug("zoomIncreaseAllowed(): " + zia + " " + currentZoomLevel + " vs. " + this.getMaxZoomLvl() );
-        }*/
+        }
         return zia;
     }
@@ -712,7 +709,7 @@
         if (zoomIncreaseAllowed()) {
             currentZoomLevel++;
-            /*if (debug) {
+            if (Main.isDebugEnabled()) {
                 Main.debug("increasing zoom level to: " + currentZoomLevel);
-            }*/
+            }
             zoomChanged();
         } else {
@@ -750,7 +747,7 @@
         //int minZoom = this.getMinZoomLvl();
         if (zoomDecreaseAllowed()) {
-            /*if (debug) {
+            if (Main.isDebugEnabled()) {
                 Main.debug("decreasing zoom level to: " + currentZoomLevel);
-            }*/
+            }
             currentZoomLevel--;
             zoomChanged();
@@ -847,7 +844,7 @@
         boolean done = ((infoflags & (ERROR | FRAMEBITS | ALLBITS)) != 0);
         needRedraw = true;
-        /*if (debug) {
+        if (Main.isDebugEnabled()) {
             Main.debug("imageUpdate() done: " + done + " calling repaint");
-        }*/
+        }
         Main.map.repaint(done ? 0 : 100);
         return !done;
@@ -911,7 +908,7 @@
         if (border != null) {
             target = source.intersection(border);
-            /*if (debug) {
+            if (Main.isDebugEnabled()) {
                 Main.debug("source: " + source + "\nborder: " + border + "\nintersection: " + target);
-            }*/
+            }
         }
 
@@ -938,7 +935,7 @@
         int img_y_end   = img_y_offset + (int)(target.getHeight() * imageYScaling);
 
-        /*if (debug) {
+        if (Main.isDebugEnabled()) {
             Main.debug("drawing image into target rect: " + target);
-        }*/
+        }
         g.drawImage(sourceImg,
                 target.x, target.y,
@@ -980,7 +977,7 @@
             Image img = getLoadedTileImage(tile);
             if (img == null || tile.hasError()) {
-                /*if (debug) {
+                if (Main.isDebugEnabled()) {
                     Main.debug("missed tile: " + tile);
-                }*/
+                }
                 missedTiles.add(tile);
                 continue;
@@ -991,5 +988,5 @@
             }
             drawImageInside(g, img, sourceRect, borderRect);
-        }// end of for
+        }
         return missedTiles;
     }
@@ -1017,5 +1014,5 @@
                 texty += 1 + fontHeight;
             }
-        }*/// end of if draw debug
+        }*/
 
         if (tile == showMetadataTile) {
@@ -1399,7 +1396,7 @@
             missedTiles = newlyMissedTiles;
         }
-        /*if (debug && missedTiles.size() > 0) {
+        if (Main.isDebugEnabled() && missedTiles.size() > 0) {
             Main.debug("still missed "+missedTiles.size()+" in the end");
-        }*/
+        }
         g.setColor(Color.red);
         g.setFont(InfoFont);
@@ -1427,10 +1424,10 @@
             myDrawString(g, tr("No tiles at this zoom level"), 120, 120);
         }
-        /*if (debug) {
+        if (Main.isDebugEnabled()) {
             myDrawString(g, tr("Current zoom: {0}", currentZoomLevel), 50, 140);
             myDrawString(g, tr("Display zoom: {0}", displayZoomLevel), 50, 155);
             myDrawString(g, tr("Pixel scale: {0}", getScaleFactor(currentZoomLevel)), 50, 170);
             myDrawString(g, tr("Best zoom: {0}", Math.log(getScaleFactor(1))/Math.log(2)/2+1), 50, 185);
-        }*/
+        }
     }
 
@@ -1440,7 +1437,7 @@
      */
     Tile getTileForPixelpos(int px, int py) {
-        /*if (debug) {
+        if (Main.isDebugEnabled()) {
             Main.debug("getTileForPixelpos("+px+", "+py+")");
-        }*/
+        }
         MapView mv = Main.map.mapView;
         Point clicked = new Point(px, py);
@@ -1458,7 +1455,7 @@
             Rectangle r = new Rectangle(pixelPos(t1));
             r.add(pixelPos(t2));
-            /*if (debug) {
+            if (Main.isDebugEnabled()) {
                 Main.debug("r: " + r + " clicked: " + clicked);
-            }*/
+            }
             if (!r.contains(clicked)) {
                 continue;
Index: trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java	(revision 7023)
+++ trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java	(revision 7024)
@@ -242,10 +242,9 @@
     @Override
     public String toString() {
-        String result = file.getName()+": "+
+        return file.getName()+": "+
         "pos = "+pos+" | "+
         "exifCoor = "+exifCoor+" | "+
         (tmp == null ? " tmp==null" :
             " [tmp] pos = "+tmp.pos);
-        return result;
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java	(revision 7023)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java	(revision 7024)
@@ -1363,8 +1363,6 @@
             if (value == null)
                 return this;
-            SourceEntry se = (SourceEntry) value;
-            JLabel label = (JLabel)super.getTableCellRendererComponent(table,
-                    fromSourceEntry(se), isSelected, hasFocus, row, column);
-            return label;
+            return super.getTableCellRendererComponent(table,
+                    fromSourceEntry((SourceEntry) value), isSelected, hasFocus, row, column);
         }
 
Index: trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java	(revision 7023)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java	(revision 7024)
@@ -502,10 +502,8 @@
         }
 
-        SequenceCommand command = new SequenceCommand(
+        return new SequenceCommand(
                 trn("Remove old keys from up to {0} object", "Remove old keys from up to {0} objects", primitives.size(), primitives.size()),
                 commands
         );
-
-        return command;
     }
 
Index: trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java	(revision 7023)
+++ trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java	(revision 7024)
@@ -50,9 +50,8 @@
     public static String explainOsmApiInitializationException(OsmApiInitializationException e) {
         Main.error(e);
-        String msg = tr(
+        return tr(
                 "<html>Failed to initialize communication with the OSM server {0}.<br>"
                 + "Check the server URL in your preferences and your internet connection.",
                 Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL));
-        return msg;
     }
 
@@ -65,5 +64,5 @@
     public static String explainMissingOAuthAccessTokenException(MissingOAuthAccessTokenException e) {
         Main.error(e);
-        String msg = tr(
+        return tr(
                 "<html>Failed to authenticate at the OSM server ''{0}''.<br>"
                 + "You are using OAuth to authenticate but currently there is no<br>"
@@ -73,5 +72,4 @@
                 Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL)
         );
-        return msg;
     }
 
@@ -411,7 +409,7 @@
      */
     public static String explainChangesetClosedException(ChangesetClosedException e) {
-        String msg;
         SimpleDateFormat dateFormat = new SimpleDateFormat();
-        msg = tr(
+        Main.error(e);
+        return tr(
                 "<html>Failed to upload to changeset <strong>{0}</strong><br>"
                 +"because it has already been closed on {1}.",
@@ -419,6 +417,4 @@
                 e.getClosedOn() == null ? "?" : dateFormat.format(e.getClosedOn())
         );
-        Main.error(e);
-        return msg;
     }
 
@@ -454,8 +450,7 @@
         }
 
-        String message = tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''<br>"
+        return tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''<br>"
                 + "for security reasons. This is most likely because you are running<br>"
                 + "in an applet and because you did not load your applet from ''{1}''.", apiUrl, host);
-        return message;
     }
 
@@ -467,11 +462,8 @@
      * @param e the exception
      */
-
     public static String explainNestedSocketException(OsmTransferException e) {
-        String apiUrl = e.getUrl();
-        String message = tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''.<br>"
-                + "Please check your internet connection.", apiUrl);
-        Main.error(e);
-        return message;
+        Main.error(e);
+        return tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''.<br>"
+                + "Please check your internet connection.", e.getUrl());
     }
 
@@ -483,14 +475,11 @@
      * @param e the exception
      */
-
     public static String explainNestedIOException(OsmTransferException e) {
         IOException ioe = getNestedException(e, IOException.class);
-        String apiUrl = e.getUrl();
-        String message = tr("<html>Failed to upload data to or download data from<br>" + "''{0}''<br>"
+        Main.error(e);
+        return tr("<html>Failed to upload data to or download data from<br>" + "''{0}''<br>"
                 + "due to a problem with transferring data.<br>"
-                + "Details (untranslated): {1}</html>", apiUrl, ioe
+                + "Details (untranslated): {1}</html>", e.getUrl(), ioe
                 .getMessage());
-        Main.error(e);
-        return message;
     }
 
@@ -503,9 +492,8 @@
     public static String explainNestedIllegalDataException(OsmTransferException e) {
         IllegalDataException ide = getNestedException(e, IllegalDataException.class);
-        String message = tr("<html>Failed to download data. "
+        Main.error(e);
+        return tr("<html>Failed to download data. "
                 + "Its format is either unsupported, ill-formed, and/or inconsistent.<br>"
                 + "<br>Details (untranslated): {0}</html>", ide.getMessage());
-        Main.error(e);
-        return message;
     }
 
@@ -516,11 +504,8 @@
      * @param e the exception
      */
-
     public static String explainInternalServerError(OsmTransferException e) {
-        String apiUrl = e.getUrl();
-        String message = tr("<html>The OSM server<br>" + "''{0}''<br>" + "reported an internal server error.<br>"
-                + "This is most likely a temporary problem. Please try again later.", apiUrl);
-        Main.error(e);
-        return message;
+        Main.error(e);
+        return tr("<html>The OSM server<br>" + "''{0}''<br>" + "reported an internal server error.<br>"
+                + "This is most likely a temporary problem. Please try again later.", e.getUrl());
     }
 
@@ -543,7 +528,6 @@
             message += tr("<br>Error message(untranslated): {0}", e.getErrorHeader());
         }
-        message = "<html>" + message + "</html>";
-        Main.error(e);
-        return message;
+        Main.error(e);
+        return "<html>" + message + "</html>";
     }
 
@@ -555,10 +539,8 @@
      */
     public static String explainBandwidthLimitExceeded(OsmApiException e) {
+        Main.error(e);
         // TODO: Write a proper error message
-        String message = explainGenericOsmApiException(e);
-        Main.error(e);
-        return message;
-    }
-
+        return explainGenericOsmApiException(e);
+    }
 
     /**
@@ -574,7 +556,6 @@
                 + "it. Please carefully check the server''s address ''{0}'' for typos."
                 , apiUrl);
-        message = "<html>" + message + "</html>";
-        Main.error(e);
-        return message;
+        Main.error(e);
+        return "<html>" + message + "</html>";
     }
 
@@ -596,9 +577,8 @@
         }
 
-        String message = tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''.<br>"
+        Main.error(e);
+        return tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''.<br>"
                 + "Host name ''{1}'' could not be resolved. <br>"
                 + "Please check the API URL in your preferences and your internet connection.", apiUrl, host);
-        Main.error(e);
-        return message;
     }
 
@@ -669,5 +649,5 @@
      */
     public static String explainGoneForUnknownPrimitive(OsmApiException e) {
-        String msg = tr(
+        return tr(
                 "<html>The server reports that an object is deleted.<br>"
                 + "<strong>Uploading failed</strong> if you tried to update or delete this object.<br> "
@@ -676,6 +656,4 @@
                 + "The error message is:<br>" + "{0}"
                 + "</html>", escapeReservedCharactersHTML(e.getMessage()));
-        return msg;
-
     }
 
@@ -686,12 +664,10 @@
      */
     public static String explainException(Exception e) {
-        String msg = "";
+        Main.error(e);
         if (e instanceof OsmTransferException) {
-            msg = explainOsmTransferException((OsmTransferException) e);
+            return explainOsmTransferException((OsmTransferException) e);
         } else {
-            msg = explainGeneric(e);
-        }
-        Main.error(e);
-        return msg;
+            return explainGeneric(e);
+        }
     }
 
Index: trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 7023)
+++ trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 7024)
@@ -804,7 +804,6 @@
             img = overlay(img, ImageProvider.get("cursor/modifier/" + overlay), OverlayPosition.SOUTHEAST);
         }
-        Cursor c = Toolkit.getDefaultToolkit().createCustomCursor(img.getImage(),
+        return Toolkit.getDefaultToolkit().createCustomCursor(img.getImage(),
                 "crosshair".equals(name) ? new Point(10, 10) : new Point(3, 2), "Cursor");
-        return c;
     }
 
