Index: /trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java	(revision 8394)
@@ -137,5 +137,5 @@
             if (dataset != null) {
                 String result = DatasetConsistencyTest.runTests(dataset);
-                if (result.length() == 0) {
+                if (result.isEmpty()) {
                     text.append("Dataset consistency test: No problems found\n");
                 } else {
Index: /trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 8394)
@@ -625,5 +625,5 @@
 
         public static SearchSetting readFromString(String s) {
-            if (s.length() == 0)
+            if (s.isEmpty())
                 return null;
 
@@ -664,5 +664,5 @@
 
         public String writeToString() {
-            if (text == null || text.length() == 0)
+            if (text == null || text.isEmpty())
                 return "";
 
Index: /trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java	(revision 8394)
@@ -619,7 +619,7 @@
                     keyPattern = Pattern.compile(key, regexFlags(false));
                 } catch (PatternSyntaxException e) {
-                    throw new ParseError(tr(rxErrorMsg, e.getPattern(), e.getIndex(), e.getMessage()));
+                    throw new ParseError(tr(rxErrorMsg, e.getPattern(), e.getIndex(), e.getMessage()), e);
                 } catch (Exception e) {
-                    throw new ParseError(tr(rxErrorMsgNoPos, key, e.getMessage()));
+                    throw new ParseError(tr(rxErrorMsgNoPos, key, e.getMessage()), e);
                 }
             } else {
@@ -630,7 +630,7 @@
                     valuePattern = Pattern.compile(this.value, regexFlags(false));
                 } catch (PatternSyntaxException e) {
-                    throw new ParseError(tr(rxErrorMsg, e.getPattern(), e.getIndex(), e.getMessage()));
+                    throw new ParseError(tr(rxErrorMsg, e.getPattern(), e.getIndex(), e.getMessage()), e);
                 } catch (Exception e) {
-                    throw new ParseError(tr(rxErrorMsgNoPos, value, e.getMessage()));
+                    throw new ParseError(tr(rxErrorMsgNoPos, value, e.getMessage()), e);
                 }
             } else {
Index: /trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java	(revision 8394)
@@ -604,5 +604,5 @@
                 return; // some basic protection
             }
-            if (address == null || path == null || address.length() == 0 || path.length() == 0) {
+            if (address == null || path == null || address.isEmpty() || path.isEmpty()) {
                 log("Error: Please specify url=\"where to get file\" and path=\"where to place it\"");
                 return;
Index: /trunk/src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 8394)
@@ -769,5 +769,5 @@
      */
     public boolean put(final String key, String value) {
-        if(value != null && value.length() == 0) {
+        if(value != null && value.isEmpty()) {
             value = null;
         }
Index: /trunk/src/org/openstreetmap/josm/data/imagery/Shape.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/imagery/Shape.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/data/imagery/Shape.java	(revision 8394)
@@ -72,5 +72,5 @@
                 throw new IllegalArgumentException(tr("Illegal latitude value ''{0}''", lat));
         } catch (NumberFormatException e) {
-            throw new IllegalArgumentException(MessageFormat.format("Illegal double value ''{0}''", sLat));
+            throw new IllegalArgumentException(MessageFormat.format("Illegal double value ''{0}''", sLat), e);
         }
 
@@ -80,5 +80,5 @@
                 throw new IllegalArgumentException(tr("Illegal longitude value ''{0}''", lon));
         } catch (NumberFormatException e) {
-            throw new IllegalArgumentException(MessageFormat.format("Illegal double value ''{0}''", sLon));
+            throw new IllegalArgumentException(MessageFormat.format("Illegal double value ''{0}''", sLon), e);
         }
 
Index: /trunk/src/org/openstreetmap/josm/data/validation/routines/RegexValidator.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/validation/routines/RegexValidator.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/data/validation/routines/RegexValidator.java	(revision 8394)
@@ -109,5 +109,5 @@
         int flags = caseSensitive ? 0: Pattern.CASE_INSENSITIVE;
         for (int i = 0; i < regexs.length; i++) {
-            if (regexs[i] == null || regexs[i].length() == 0) {
+            if (regexs[i] == null || regexs[i].isEmpty()) {
                 throw new IllegalArgumentException("Regular expression[" + i + "] is missing");
             }
Index: /trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java	(revision 8394)
@@ -354,5 +354,5 @@
                 withErrors.put(p, "LK");
             }
-            if (checkValues && (value==null || value.trim().length() == 0) && !withErrors.contains(p, "EV")) {
+            if (checkValues && (value==null || value.trim().isEmpty()) && !withErrors.contains(p, "EV")) {
                 errors.add( new TestError(this, Severity.WARNING, tr("Tags with empty values"),
                         tr(s, key), MessageFormat.format(s, key), EMPTY_VALUES, p) );
@@ -563,5 +563,5 @@
                 String key = prop.getKey();
                 String value = prop.getValue();
-                if (value == null || value.trim().length() == 0) {
+                if (value == null || value.trim().isEmpty()) {
                     commands.add(new ChangePropertyCommand(p, key, null));
                 } else if (value.startsWith(" ") || value.endsWith(" ")) {
@@ -679,5 +679,5 @@
             try {
                 description = m.group(1);
-                if (description != null && description.length() == 0) {
+                if (description != null && description.isEmpty()) {
                     description = null;
                 }
Index: /trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java	(revision 8394)
@@ -274,5 +274,5 @@
                 }
                 if(n == null && way.get("building") != null) n = tr("building");
-                if(n == null || n.length() == 0) {
+                if(n == null || n.isEmpty()) {
                     n = String.valueOf(way.getId());
                 }
Index: /trunk/src/org/openstreetmap/josm/gui/MainMenu.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/MainMenu.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/MainMenu.java	(revision 8394)
@@ -1013,5 +1013,5 @@
             }
             currentSearchText = searchTerm;
-            if (searchTerm.length() == 0) {
+            if (searchTerm.isEmpty()) {
                 // No text to search
                 hideMenu();
Index: /trunk/src/org/openstreetmap/josm/gui/PleaseWaitDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/PleaseWaitDialog.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/PleaseWaitDialog.java	(revision 8394)
@@ -111,5 +111,5 @@
     @Override
     public void setCustomText(String text) {
-        if(text == null || text.trim().length() == 0) {
+        if(text == null || text.trim().isEmpty()) {
             customText.setVisible(false);
             adjustLayout();
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanel.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanel.java	(revision 8394)
@@ -984,5 +984,5 @@
         public void validate() {
             String value  = getComponent().getText();
-            if (value == null || value.trim().length() == 0) {
+            if (value == null || value.trim().isEmpty()) {
                 feedbackInvalid("");
                 return;
@@ -1003,5 +1003,5 @@
         public int getUid() {
             String value  = getComponent().getText();
-            if (value == null || value.trim().length() == 0) return 0;
+            if (value == null || value.trim().isEmpty()) return 0;
             try {
                 int uid = Integer.parseInt(value.trim());
@@ -1031,5 +1031,5 @@
         public void validate() {
             String value  = getComponent().getText();
-            if (value.trim().length() == 0) {
+            if (value.trim().isEmpty()) {
                 feedbackInvalid(tr("<html>The  current value is not a valid user name.<br>Please enter an non-empty user name.</html>"));
                 return;
@@ -1120,5 +1120,5 @@
         @Override
         public boolean isValid() {
-            if (getComponent().getText().trim().length() == 0) return true;
+            if (getComponent().getText().trim().isEmpty()) return true;
             return getDate() != null;
         }
@@ -1157,5 +1157,5 @@
 
         public Date getDate() {
-            if (getComponent().getText().trim().length() == 0)
+            if (getComponent().getText().trim().isEmpty())
                 return null;
 
Index: /trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java	(revision 8394)
@@ -296,5 +296,5 @@
         @Override
         public void actionPerformed(ActionEvent e) {
-            if (!isEnabled() || cbSearchExpression.getText().trim().length() == 0)
+            if (!isEnabled() || cbSearchExpression.getText().trim().isEmpty())
                 return;
             cbSearchExpression.addCurrentItemToHistory();
Index: /trunk/src/org/openstreetmap/josm/gui/help/HelpUtil.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/help/HelpUtil.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/help/HelpUtil.java	(revision 8394)
@@ -144,5 +144,5 @@
     public static String buildAbsoluteHelpTopic(String topic, LocaleType type) {
         String prefix = getHelpTopicPrefix(type);
-        if (prefix == null || topic == null || topic.trim().length() == 0 || "/".equals(topic.trim()))
+        if (prefix == null || topic == null || topic.trim().isEmpty() || "/".equals(topic.trim()))
             return prefix;
         prefix += "/" + topic;
Index: /trunk/src/org/openstreetmap/josm/gui/io/DownloadFileTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/io/DownloadFileTask.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/io/DownloadFileTask.java	(revision 8394)
@@ -54,6 +54,14 @@
 
     private static class DownloadException extends Exception {
-        public DownloadException(String msg) {
-            super(msg);
+        /**
+         * Constructs a new {@code DownloadException}.
+         * @param message the detail message. The detail message is saved for
+         *          later retrieval by the {@link #getMessage()} method.
+         * @param  cause the cause (which is saved for later retrieval by the
+         *         {@link #getCause()} method).  (A <tt>null</tt> value is
+         *         permitted, and indicates that the cause is nonexistent or unknown.)
+         */
+        public DownloadException(String message, Throwable cause) {
+            super(message, cause);
         }
     }
@@ -133,9 +141,9 @@
             String msg = tr("Cannot download file ''{0}''. Its download link ''{1}'' is not a valid URL. Skipping download.", file.getName(), address);
             Main.warn(msg);
-            throw new DownloadException(msg);
+            throw new DownloadException(msg, e);
         } catch (IOException e) {
             if (canceled)
                 return;
-            throw new DownloadException(e.getMessage());
+            throw new DownloadException(e.getMessage(), e);
         } finally {
             closeConnectionIfNeeded();
Index: /trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java	(revision 8394)
@@ -120,5 +120,5 @@
                     sb.append("<hr/>");
                     String userName = XmlWriter.encode(comment.getUser().getName());
-                    if (userName == null || userName.trim().length() == 0) {
+                    if (userName == null || userName.trim().isEmpty()) {
                         userName = "&lt;Anonymous&gt;";
                     }
Index: /trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 8394)
@@ -811,5 +811,5 @@
         public void actionPerformed(ActionEvent e) {
             String result = DatasetConsistencyTest.runTests(data);
-            if (result.length() == 0) {
+            if (result.isEmpty()) {
                 JOptionPane.showMessageDialog(Main.parent, tr("No problems found"));
             } else {
Index: /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java	(revision 8394)
@@ -317,5 +317,5 @@
             String tzId = Main.pref.get("geoimage.timezoneid", "");
             TimeZone defaultTz;
-            if (tzId.length() == 0) {
+            if (tzId.isEmpty()) {
                 defaultTz = TimeZone.getDefault();
             } else {
@@ -1308,8 +1308,8 @@
     private double parseTimezone(String timezone) throws ParseException {
 
+        if (timezone.isEmpty())
+            return 0;
+
         String error = tr("Error while parsing timezone.\nExpected format: {0}", "+H:MM");
-
-        if (timezone.length() == 0)
-            return 0;
 
         char sgnTimezone = '+';
@@ -1322,5 +1322,5 @@
             case ' ' :
                 if (state != 2 || hTimezone.length() != 0)
-                    throw new ParseException(error,0);
+                    throw new ParseException(error, i);
                 break;
             case '+' :
@@ -1330,5 +1330,5 @@
                     state = 2;
                 } else
-                    throw new ParseException(error,0);
+                    throw new ParseException(error, i);
                 break;
             case ':' :
@@ -1337,5 +1337,5 @@
                     state = 3;
                 } else
-                    throw new ParseException(error,0);
+                    throw new ParseException(error, i);
                 break;
             case '0' : case '1' : case '2' : case '3' : case '4' :
@@ -1351,9 +1351,9 @@
                     break;
                 default :
-                    throw new ParseException(error,0);
+                    throw new ParseException(error, i);
                 }
                 break;
             default :
-                throw new ParseException(error,0);
+                throw new ParseException(error, i);
             }
         }
@@ -1368,9 +1368,9 @@
         } catch (NumberFormatException nfe) {
             // Invalid timezone
-            throw new ParseException(error,0);
-        }
-
-        if (h > 12 || m > 59 )
-            throw new ParseException(error,0);
+            throw new ParseException(error, 0);
+        }
+
+        if (h > 12 || m > 59)
+            throw new ParseException(error, 0);
         else
             return (h + m / 60.0) * (sgnTimezone == '-' ? -1 : 1);
@@ -1380,5 +1380,5 @@
         String error = tr("Error while parsing offset.\nExpected format: {0}", "number");
 
-        if (offset.length() > 0) {
+        if (!offset.isEmpty()) {
             try {
                 if(offset.startsWith("+")) {
Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 8394)
@@ -224,5 +224,5 @@
 
             /* non-prefixed path is generic path, always take it */
-            if(a[0].length() == 0 || source.getPrefName().equals(a[0])) {
+            if(a[0].isEmpty() || source.getPrefName().equals(a[0])) {
                 dirs.add(a[1]);
             }
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java	(revision 8394)
@@ -703,5 +703,5 @@
 
     private static void prepareFileChooser(String url, AbstractFileChooser fc) {
-        if (url == null || url.trim().length() == 0) return;
+        if (url == null || url.trim().isEmpty()) return;
         URL sourceUrl = null;
         try {
Index: /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java	(revision 8394)
@@ -780,5 +780,5 @@
                 LAST_VALUES.put(key, v);
             }
-            if (v.equals(originalValue) || (originalValue == null && v.length() == 0))
+            if (v.equals(originalValue) || (originalValue == null && v.isEmpty()))
                 return;
 
@@ -1156,5 +1156,5 @@
             // no change if same as before
             if (originalValue == null) {
-                if (value.length() == 0)
+                if (value.isEmpty())
                     return;
             } else if (value.equals(originalValue.toString()))
Index: /trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java	(revision 8394)
@@ -81,5 +81,5 @@
                 try {
                     Long.parseLong(str);
-                    if (currentText.length() == 0) {
+                    if (currentText.isEmpty()) {
                         // we don't autocomplete on numbers
                         super.insertString(offs, str, a);
Index: /trunk/src/org/openstreetmap/josm/gui/util/RotationAngle.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/util/RotationAngle.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/gui/util/RotationAngle.java	(revision 8394)
@@ -39,11 +39,9 @@
      */
     public static RotationAngle buildStaticRotation(final String string) {
-        final double value;
         try {
-            value = parseCardinalRotation(string);
-        } catch (IllegalArgumentException ignore) {
-            throw new IllegalArgumentException("Invalid string: " + string);
+            return buildStaticRotation(parseCardinalRotation(string));
+        } catch (IllegalArgumentException e) {
+            throw new IllegalArgumentException("Invalid string: " + string, e);
         }
-        return buildStaticRotation(value);
     }
 
Index: /trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java	(revision 8394)
@@ -315,4 +315,15 @@
 
         /**
+         * Constructs a new {@code ChangesetQueryUrlException} with the specified cause and detail message.
+         *
+         * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
+         * @param  cause the cause (which is saved for later retrieval by the {@link #getCause()} method).
+         *         (A <tt>null</tt> value is permitted, and indicates that the cause is nonexistent or unknown.)
+         */
+        public ChangesetQueryUrlException(String message, Throwable cause) {
+            super(message, cause);
+        }
+
+        /**
          * Constructs a new {@code ChangesetQueryUrlException} with the specified cause and a detail message of
          * <tt>(cause==null ? null : cause.toString())</tt> (which typically contains the class and detail message of <tt>cause</tt>).
@@ -329,12 +340,15 @@
         protected int parseUid(String value) throws ChangesetQueryUrlException {
             if (value == null || value.trim().isEmpty())
-                throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", "uid", value));
+                throw new ChangesetQueryUrlException(
+                        tr("Unexpected value for ''{0}'' in changeset query url, got {1}", "uid", value));
             int id;
             try {
                 id = Integer.parseInt(value);
                 if (id <= 0)
-                    throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", "uid", value));
+                    throw new ChangesetQueryUrlException(
+                            tr("Unexpected value for ''{0}'' in changeset query url, got {1}", "uid", value));
             } catch(NumberFormatException e) {
-                throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", "uid", value));
+                throw new ChangesetQueryUrlException(
+                        tr("Unexpected value for ''{0}'' in changeset query url, got {1}", "uid", value), e);
             }
             return id;
@@ -343,5 +357,6 @@
         protected boolean parseBoolean(String value, String parameter) throws ChangesetQueryUrlException {
             if (value == null || value.trim().isEmpty())
-                throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", parameter, value));
+                throw new ChangesetQueryUrlException(
+                        tr("Unexpected value for ''{0}'' in changeset query url, got {1}", parameter, value));
             switch (value) {
             case "true":
@@ -350,5 +365,6 @@
                 return false;
             default:
-                throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", parameter, value));
+                throw new ChangesetQueryUrlException(
+                        tr("Unexpected value for ''{0}'' in changeset query url, got {1}", parameter, value));
             }
         }
@@ -356,10 +372,12 @@
         protected Date parseDate(String value, String parameter) throws ChangesetQueryUrlException {
             if (value == null || value.trim().isEmpty())
-                throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", parameter, value));
+                throw new ChangesetQueryUrlException(
+                        tr("Unexpected value for ''{0}'' in changeset query url, got {1}", parameter, value));
             DateFormat formatter = DateUtils.newIsoDateTimeFormat();
             try {
                 return formatter.parse(value);
             } catch(ParseException e) {
-                throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", parameter, value));
+                throw new ChangesetQueryUrlException(
+                        tr("Unexpected value for ''{0}'' in changeset query url, got {1}", parameter, value), e);
             }
         }
@@ -368,5 +386,6 @@
             String[] dates = value.split(",");
             if (dates == null || dates.length == 0 || dates.length > 2)
-                throw new ChangesetQueryUrlException(tr("Unexpected value for ''{0}'' in changeset query url, got {1}", "time", value));
+                throw new ChangesetQueryUrlException(
+                        tr("Unexpected value for ''{0}'' in changeset query url, got {1}", "time", value));
             if (dates.length == 1)
                 return new Date[]{parseDate(dates[0], "time")};
@@ -395,10 +414,12 @@
                 case "uid":
                     if (queryParams.containsKey("display_name"))
-                        throw new ChangesetQueryUrlException(tr("Cannot create a changeset query including both the query parameters ''uid'' and ''display_name''"));
+                        throw new ChangesetQueryUrlException(
+                                tr("Cannot create a changeset query including both the query parameters ''uid'' and ''display_name''"));
                     csQuery.forUser(parseUid(queryParams.get("uid")));
                     break;
                 case "display_name":
                     if (queryParams.containsKey("uid"))
-                        throw new ChangesetQueryUrlException(tr("Cannot create a changeset query including both the query parameters ''uid'' and ''display_name''"));
+                        throw new ChangesetQueryUrlException(
+                                tr("Cannot create a changeset query including both the query parameters ''uid'' and ''display_name''"));
                     csQuery.forUser(queryParams.get("display_name"));
                     break;
@@ -435,5 +456,6 @@
                     break;
                 default:
-                    throw new ChangesetQueryUrlException(tr("Unsupported parameter ''{0}'' in changeset query string", k));
+                    throw new ChangesetQueryUrlException(
+                            tr("Unsupported parameter ''{0}'' in changeset query string", k));
                 }
             }
Index: /trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java	(revision 8394)
@@ -111,5 +111,5 @@
     public final void initFromPreferences() {
         String value = Main.pref.get(ProxyPreferencesPanel.PROXY_POLICY);
-        if (value.length() == 0) {
+        if (value.isEmpty()) {
             proxyPolicy = ProxyPolicy.NO_PROXY;
         } else {
Index: /trunk/src/org/openstreetmap/josm/io/OsmApi.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/io/OsmApi.java	(revision 8394)
@@ -361,5 +361,5 @@
             osm.setChangesetId(getChangeset().getId());
         } catch(NumberFormatException e){
-            throw new OsmTransferException(tr("Unexpected format of ID replied by the server. Got ''{0}''.", ret));
+            throw new OsmTransferException(tr("Unexpected format of ID replied by the server. Got ''{0}''.", ret), e);
         }
     }
@@ -384,5 +384,5 @@
         } catch(NumberFormatException e) {
             throw new OsmTransferException(tr("Unexpected format of new version of modified primitive ''{0}''. Got ''{1}''.",
-                    osm.getId(), ret));
+                    osm.getId(), ret), e);
         }
     }
@@ -427,5 +427,5 @@
                 changeset.setOpen(true);
             } catch(NumberFormatException e){
-                throw new OsmTransferException(tr("Unexpected format of ID replied by the server. Got ''{0}''.", ret));
+                throw new OsmTransferException(tr("Unexpected format of ID replied by the server. Got ''{0}''.", ret), e);
             }
             progressMonitor.setCustomText(tr("Successfully opened changeset {0}",changeset.getId()));
Index: /trunk/src/org/openstreetmap/josm/io/OsmChangeImporter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmChangeImporter.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/io/OsmChangeImporter.java	(revision 8394)
@@ -35,10 +35,11 @@
     }
 
-    @Override public void importData(File file, ProgressMonitor progressMonitor) throws IOException, IllegalDataException {
+    @Override
+    public void importData(File file, ProgressMonitor progressMonitor) throws IOException, IllegalDataException {
         try {
             importData(Compression.getUncompressedFileInputStream(file), file, progressMonitor);
         } catch (FileNotFoundException e) {
             Main.error(e);
-            throw new IOException(tr("File ''{0}'' does not exist.", file.getName()));
+            throw new IOException(tr("File ''{0}'' does not exist.", file.getName()), e);
         }
     }
Index: /trunk/src/org/openstreetmap/josm/io/OsmServerUserInfoReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmServerUserInfoReader.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/io/OsmServerUserInfoReader.java	(revision 8394)
@@ -52,5 +52,5 @@
                 userInfo.setId(Integer.parseInt(v));
             } catch(NumberFormatException e) {
-                throw new XmlParsingException(tr("Illegal value for attribute ''{0}'' on XML tag ''{1}''. Got {2}.", "id", "user", v));
+                throw new XmlParsingException(tr("Illegal value for attribute ''{0}'' on XML tag ''{1}''. Got {2}.", "id", "user", v), e);
             }
             // -- display name
@@ -77,5 +77,6 @@
                     lat = Double.parseDouble(v);
                 } catch(NumberFormatException e) {
-                    throw new XmlParsingException(tr("Illegal value for attribute ''{0}'' on XML tag ''{1}''. Got {2}.", "lat", "home", v));
+                    throw new XmlParsingException(tr("Illegal value for attribute ''{0}'' on XML tag ''{1}''. Got {2}.",
+                            "lat", "home", v), e);
                 }
 
@@ -87,5 +88,6 @@
                     lon = Double.parseDouble(v);
                 } catch(NumberFormatException e) {
-                    throw new XmlParsingException(tr("Illegal value for attribute ''{0}'' on XML tag ''{1}''. Got {2}.", "lon", "home", v));
+                    throw new XmlParsingException(tr("Illegal value for attribute ''{0}'' on XML tag ''{1}''. Got {2}.",
+                            "lon", "home", v), e);
                 }
 
@@ -97,5 +99,6 @@
                     zoom = Integer.parseInt(v);
                 } catch(NumberFormatException e) {
-                    throw new XmlParsingException(tr("Illegal value for attribute ''{0}'' on XML tag ''{1}''. Got {2}.", "zoom", "home", v));
+                    throw new XmlParsingException(tr("Illegal value for attribute ''{0}'' on XML tag ''{1}''. Got {2}.",
+                            "zoom", "home", v), e);
                 }
                 userInfo.setHome(new LatLon(lat,lon));
Index: /trunk/src/org/openstreetmap/josm/io/ProgressInputStream.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/ProgressInputStream.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/io/ProgressInputStream.java	(revision 8394)
@@ -38,5 +38,5 @@
             progressMonitor.finishTask();
             if (con.getHeaderField("Error") != null)
-                throw new OsmTransferException(tr(con.getHeaderField("Error")));
+                throw new OsmTransferException(tr(con.getHeaderField("Error")), e);
             throw new OsmTransferException(e);
         }
Index: /trunk/src/org/openstreetmap/josm/io/remotecontrol/DNSName.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/remotecontrol/DNSName.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/io/remotecontrol/DNSName.java	(revision 8394)
@@ -71,5 +71,5 @@
      */
     public DNSName(String name) throws IOException {
-        if (name == null || name.length() == 0)
+        if (name == null || name.isEmpty())
             throw new IOException("DNS name must not be null");
         if (name.indexOf(' ') != -1)
Index: /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java	(revision 8394)
@@ -30,5 +30,5 @@
     private double lat;
     private double lon;
-    
+
     private Node node;
 
@@ -47,5 +47,5 @@
         return new String[] { "lat", "lon" };
     }
-    
+
     @Override
     public String[] getOptionalParams()
@@ -63,8 +63,8 @@
         return new String[] {
             "/add_node?lat=11&lon=22",
-            "/add_node?lon=13.3&lat=53.2&addtags=natural=tree|name=%20%20%20==Great%20Oak==" 
+            "/add_node?lon=13.3&lat=53.2&addtags=natural=tree|name=%20%20%20==Great%20Oak=="
         };
     }
-    
+
     @Override
     public String getPermissionMessage() {
@@ -122,5 +122,5 @@
             lon = Double.parseDouble(args.get("lon"));
         } catch (NumberFormatException e) {
-            throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")");
+            throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")", e);
         }
         if (!Main.main.hasEditLayer()) {
Index: /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java	(revision 8394)
@@ -104,5 +104,5 @@
                 allCoordinates.add(new LatLon(lat, lon));
             } catch (NumberFormatException e) {
-                throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")");
+                throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")", e);
             }
         }
Index: /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java	(revision 8394)
@@ -272,5 +272,5 @@
             maxlon = LatLon.roundToOsmPrecision(Double.parseDouble(args.get("right")));
         } catch (NumberFormatException e) {
-            throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")");
+            throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")", e);
         }
 
Index: /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java	(revision 8394)
@@ -223,5 +223,5 @@
         if(mandatory != null) for (String key : mandatory) {
             String value = args.get(key);
-            if ((value == null) || (value.length() == 0)) {
+            if (value == null || value.isEmpty()) {
                 error = true;
                 Main.warn("'" + myCommand + "' remote control request must have '" + key + "' parameter");
Index: /trunk/src/org/openstreetmap/josm/io/session/SessionReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/session/SessionReader.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/io/session/SessionReader.java	(revision 8394)
@@ -179,5 +179,5 @@
                     return new BufferedInputStream(new FileInputStream(file));
                 } catch (FileNotFoundException e) {
-                    throw new IOException(tr("File ''{0}'' does not exist.", file.getPath()));
+                    throw new IOException(tr("File ''{0}'' does not exist.", file.getPath()), e);
                 }
             } else if (inZipPath != null) {
Index: /trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java	(revision 8394)
@@ -137,7 +137,8 @@
             }
         } catch (MalformedURLException e) {
-            String msg = tr("Cannot download plugin ''{0}''. Its download link ''{1}'' is not a valid URL. Skipping download.", pi.name, pi.downloadlink);
+            String msg = tr("Cannot download plugin ''{0}''. Its download link ''{1}'' is not a valid URL. Skipping download.",
+                    pi.name, pi.downloadlink);
             Main.warn(msg);
-            throw new PluginDownloadException(msg);
+            throw new PluginDownloadException(msg, e);
         } catch (IOException e) {
             if (canceled)
Index: /trunk/src/org/openstreetmap/josm/tools/CopyList.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/CopyList.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/tools/CopyList.java	(revision 8394)
@@ -178,5 +178,5 @@
             } catch (IndexOutOfBoundsException e) {
                 checkForComodification();
-                throw new NoSuchElementException();
+                throw new NoSuchElementException(e.getMessage());
             }
         }
@@ -196,5 +196,5 @@
                 expectedModCount = modCount;
             } catch (IndexOutOfBoundsException e) {
-                throw new ConcurrentModificationException();
+                throw new ConcurrentModificationException(e);
             }
         }
Index: /trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java	(revision 8393)
+++ /trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java	(revision 8394)
@@ -153,5 +153,7 @@
             Matcher m = p.matcher(preferenceValue);
             if (!m.find())
-                throw new WindowGeometryException(tr("Preference with key ''{0}'' does not include ''{1}''. Cannot restore window geometry from preferences.", preferenceKey, field));
+                throw new WindowGeometryException(
+                        tr("Preference with key ''{0}'' does not include ''{1}''. Cannot restore window geometry from preferences.",
+                                preferenceKey, field));
             v = m.group(1);
             return Integer.parseInt(v);
@@ -159,7 +161,11 @@
             throw e;
         } catch(NumberFormatException e) {
-            throw new WindowGeometryException(tr("Preference with key ''{0}'' does not provide an int value for ''{1}''. Got {2}. Cannot restore window geometry from preferences.", preferenceKey, field, v));
+            throw new WindowGeometryException(
+                    tr("Preference with key ''{0}'' does not provide an int value for ''{1}''. Got {2}. Cannot restore window geometry from preferences.",
+                            preferenceKey, field, v), e);
         } catch(Exception e) {
-            throw new WindowGeometryException(tr("Failed to parse field ''{1}'' in preference with key ''{0}''. Exception was: {2}. Cannot restore window geometry from preferences.", preferenceKey, field, e.toString()), e);
+            throw new WindowGeometryException(
+                    tr("Failed to parse field ''{1}'' in preference with key ''{0}''. Exception was: {2}. Cannot restore window geometry from preferences.",
+                            preferenceKey, field, e.toString()), e);
         }
     }
@@ -168,5 +174,6 @@
         String value = Main.pref.get(preferenceKey);
         if (value == null || value.isEmpty())
-            throw new WindowGeometryException(tr("Preference with key ''{0}'' does not exist. Cannot restore window geometry from preferences.", preferenceKey));
+            throw new WindowGeometryException(
+                    tr("Preference with key ''{0}'' does not exist. Cannot restore window geometry from preferences.", preferenceKey));
         topLeft = new Point();
         extent = new Dimension();
