Index: trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java	(revision 18732)
+++ trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java	(revision 18735)
@@ -12,5 +12,4 @@
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatterBuilder;
-import java.time.format.DateTimeParseException;
 import java.time.format.FormatStyle;
 import java.util.Date;
@@ -81,82 +80,82 @@
     public static Instant parseInstant(String str) {
         // "2007-07-25T09:26:24{Z|{+|-}01[:00]}"
-        if (checkLayout(str, "xxxx-xx-xx") ||
-                checkLayout(str, "xxxx-xx") ||
-                checkLayout(str, "xxxx")) {
-            final ZonedDateTime local = ZonedDateTime.of(
-                    parsePart4(str, 0),
-                    str.length() > 5 ? parsePart2(str, 5) : 1,
-                    str.length() > 8 ? parsePart2(str, 8) : 1,
-                    0, 0, 0, 0, ZoneOffset.UTC);
-            return local.toInstant();
-        } else if (checkLayout(str, "xxxx-xx-xxTxx:xx:xxZ") ||
-                checkLayout(str, "xxxx-xx-xxTxx:xx:xx") ||
-                checkLayout(str, "xxxx:xx:xx xx:xx:xx") ||
-                checkLayout(str, "xxxx/xx/xx xx:xx:xx") ||
-                checkLayout(str, "xxxx-xx-xx xx:xx:xxZ") ||
-                checkLayout(str, "xxxx-xx-xx xx:xx:xx UTC") ||
-                checkLayout(str, "xxxx-xx-xxTxx:xx:xx+xx") ||
-                checkLayout(str, "xxxx-xx-xxTxx:xx:xx-xx") ||
-                checkLayout(str, "xxxx-xx-xxTxx:xx:xx+xx:00") ||
-                checkLayout(str, "xxxx-xx-xxTxx:xx:xx-xx:00")) {
-            final ZonedDateTime local = ZonedDateTime.of(
-                parsePart4(str, 0),
-                parsePart2(str, 5),
-                parsePart2(str, 8),
-                parsePart2(str, 11),
-                parsePart2(str, 14),
-                parsePart2(str, 17),
-                0,
-                ZoneOffset.UTC
-            );
-            if (str.length() == 22 || str.length() == 25) {
-                final int plusHr = parsePart2(str, 20);
-                return local.plusHours(str.charAt(19) == '+' ? -plusHr : plusHr).toInstant();
+        try {
+            if (checkLayout(str, "xxxx-xx-xx") ||
+                    checkLayout(str, "xxxx-xx") ||
+                    checkLayout(str, "xxxx")) {
+                final ZonedDateTime local = ZonedDateTime.of(
+                        parsePart4(str, 0),
+                        str.length() > 5 ? parsePart2(str, 5) : 1,
+                        str.length() > 8 ? parsePart2(str, 8) : 1,
+                        0, 0, 0, 0, ZoneOffset.UTC);
+                return local.toInstant();
+            } else if (checkLayout(str, "xxxx-xx-xxTxx:xx:xxZ") ||
+                    checkLayout(str, "xxxx-xx-xxTxx:xx:xx") ||
+                    checkLayout(str, "xxxx:xx:xx xx:xx:xx") ||
+                    checkLayout(str, "xxxx/xx/xx xx:xx:xx") ||
+                    checkLayout(str, "xxxx-xx-xx xx:xx:xxZ") ||
+                    checkLayout(str, "xxxx-xx-xx xx:xx:xx UTC") ||
+                    checkLayout(str, "xxxx-xx-xxTxx:xx:xx+xx") ||
+                    checkLayout(str, "xxxx-xx-xxTxx:xx:xx-xx") ||
+                    checkLayout(str, "xxxx-xx-xxTxx:xx:xx+xx:00") ||
+                    checkLayout(str, "xxxx-xx-xxTxx:xx:xx-xx:00")) {
+                final ZonedDateTime local = ZonedDateTime.of(
+                        parsePart4(str, 0),
+                        parsePart2(str, 5),
+                        parsePart2(str, 8),
+                        parsePart2(str, 11),
+                        parsePart2(str, 14),
+                        parsePart2(str, 17),
+                        0,
+                        ZoneOffset.UTC
+                );
+                if (str.length() == 22 || str.length() == 25) {
+                    final int plusHr = parsePart2(str, 20);
+                    return local.plusHours(str.charAt(19) == '+' ? -plusHr : plusHr).toInstant();
+                }
+                return local.toInstant();
+            } else if (checkLayout(str, "xxxx-xx-xxTxx:xx:xx.xxxZ") ||
+                    checkLayout(str, "xxxx-xx-xxTxx:xx:xx.xxx") ||
+                    checkLayout(str, "xxxx:xx:xx xx:xx:xx.xxx") ||
+                    checkLayout(str, "xxxx/xx/xx xx:xx:xx.xxx") ||
+                    checkLayout(str, "xxxx-xx-xxTxx:xx:xx.xxx+xx:00") ||
+                    checkLayout(str, "xxxx-xx-xxTxx:xx:xx.xxx-xx:00")) {
+                final ZonedDateTime local = ZonedDateTime.of(
+                        parsePart4(str, 0),
+                        parsePart2(str, 5),
+                        parsePart2(str, 8),
+                        parsePart2(str, 11),
+                        parsePart2(str, 14),
+                        parsePart2(str, 17),
+                        parsePart3(str, 20) * 1_000_000,
+                        ZoneOffset.UTC
+                );
+                if (str.length() == 29) {
+                    final int plusHr = parsePart2(str, 24);
+                    return local.plusHours(str.charAt(23) == '+' ? -plusHr : plusHr).toInstant();
+                }
+                return local.toInstant();
+            } else if (checkLayout(str, "xxxx/xx/xx xx:xx:xx.xxxxxx")) {
+                return ZonedDateTime.of(
+                        parsePart4(str, 0),
+                        parsePart2(str, 5),
+                        parsePart2(str, 8),
+                        parsePart2(str, 11),
+                        parsePart2(str, 14),
+                        parsePart2(str, 17),
+                        parsePart6(str, 20) * 1_000,
+                        ZoneOffset.UTC
+                ).toInstant();
+            } else {
+                // example date format "18-AUG-08 13:33:03"
+                SimpleDateFormat f = new SimpleDateFormat("dd-MMM-yy HH:mm:ss");
+                Date d = f.parse(str, new ParsePosition(0));
+                if (d != null)
+                    return d.toInstant();
             }
-            return local.toInstant();
-        } else if (checkLayout(str, "xxxx-xx-xxTxx:xx:xx.xxxZ") ||
-                checkLayout(str, "xxxx-xx-xxTxx:xx:xx.xxx") ||
-                checkLayout(str, "xxxx:xx:xx xx:xx:xx.xxx") ||
-                checkLayout(str, "xxxx/xx/xx xx:xx:xx.xxx") ||
-                checkLayout(str, "xxxx-xx-xxTxx:xx:xx.xxx+xx:00") ||
-                checkLayout(str, "xxxx-xx-xxTxx:xx:xx.xxx-xx:00")) {
-            final ZonedDateTime local = ZonedDateTime.of(
-                parsePart4(str, 0),
-                parsePart2(str, 5),
-                parsePart2(str, 8),
-                parsePart2(str, 11),
-                parsePart2(str, 14),
-                parsePart2(str, 17),
-                parsePart3(str, 20) * 1_000_000,
-                ZoneOffset.UTC
-            );
-            if (str.length() == 29) {
-                final int plusHr = parsePart2(str, 24);
-                return local.plusHours(str.charAt(23) == '+' ? -plusHr : plusHr).toInstant();
-            }
-            return local.toInstant();
-        } else if (checkLayout(str, "xxxx/xx/xx xx:xx:xx.xxxxxx")) {
-            return ZonedDateTime.of(
-                parsePart4(str, 0),
-                parsePart2(str, 5),
-                parsePart2(str, 8),
-                parsePart2(str, 11),
-                parsePart2(str, 14),
-                parsePart2(str, 17),
-                parsePart6(str, 20) * 1_000,
-                ZoneOffset.UTC
-            ).toInstant();
-        } else {
-            // example date format "18-AUG-08 13:33:03"
-            SimpleDateFormat f = new SimpleDateFormat("dd-MMM-yy HH:mm:ss");
-            Date d = f.parse(str, new ParsePosition(0));
-            if (d != null)
-                return d.toInstant();
-        }
-
-        try {
+
             // slow path for fractional seconds different from millisecond precision
             return ZonedDateTime.parse(str).toInstant();
-        } catch (IllegalArgumentException | DateTimeParseException ex) {
+        } catch (IllegalArgumentException | DateTimeException ex) {
             throw new UncheckedParseException("The date string (" + str + ") could not be parsed.", ex);
         }
@@ -213,4 +212,10 @@
     }
 
+    /**
+     * Check text for a specified layout
+     * @param text The text to check
+     * @param pattern The pattern to use
+     * @return {@code true} if the layout matches, otherwise {@code false}
+     */
     private static boolean checkLayout(String text, String pattern) {
         if (text.length() != pattern.length())
@@ -244,10 +249,10 @@
 
     private static int parsePart6(String str, int off) {
-        return 100000 * num(str.charAt(off))
-              + 10000 * num(str.charAt(off + 1))
-               + 1000 * num(str.charAt(off + 2))
-                + 100 * num(str.charAt(off + 3))
-                 + 10 * num(str.charAt(off + 4))
-                      + num(str.charAt(off + 5));
+        return 100_000 * num(str.charAt(off))
+              + 10_000 * num(str.charAt(off + 1))
+               + 1_000 * num(str.charAt(off + 2))
+                 + 100 * num(str.charAt(off + 3))
+                  + 10 * num(str.charAt(off + 4))
+                       + num(str.charAt(off + 5));
     }
 
@@ -268,5 +273,5 @@
      */
     public static DateFormat getDateFormat(int dateStyle) {
-        if (PROP_ISO_DATES.get()) {
+        if (Boolean.TRUE.equals(PROP_ISO_DATES.get())) {
             return newIsoDateFormat();
         } else {
@@ -281,5 +286,5 @@
      */
     public static DateTimeFormatter getDateFormatter(FormatStyle dateStyle) {
-        DateTimeFormatter formatter = PROP_ISO_DATES.get()
+        DateTimeFormatter formatter = Boolean.TRUE.equals(PROP_ISO_DATES.get())
                 ? DateTimeFormatter.ISO_LOCAL_DATE
                 : DateTimeFormatter.ofLocalizedDate(dateStyle);
@@ -306,5 +311,5 @@
      */
     public static DateFormat getTimeFormat(int timeStyle) {
-        if (PROP_ISO_DATES.get()) {
+        if (Boolean.TRUE.equals(PROP_ISO_DATES.get())) {
             // This is not strictly conform to ISO 8601. We just want to avoid US-style times such as 3.30pm
             return new SimpleDateFormat("HH:mm:ss");
@@ -320,5 +325,5 @@
      */
     public static DateTimeFormatter getTimeFormatter(FormatStyle timeStyle) {
-        DateTimeFormatter formatter = PROP_ISO_DATES.get()
+        DateTimeFormatter formatter = Boolean.TRUE.equals(PROP_ISO_DATES.get())
                 ? DateTimeFormatter.ISO_LOCAL_TIME
                 : DateTimeFormatter.ofLocalizedTime(timeStyle);
@@ -346,5 +351,5 @@
      */
     public static DateFormat getDateTimeFormat(int dateStyle, int timeStyle) {
-        if (PROP_ISO_DATES.get()) {
+        if (Boolean.TRUE.equals(PROP_ISO_DATES.get())) {
             // This is not strictly conform to ISO 8601. We just want to avoid US-style times such as 3.30pm
             // and we don't want to use the 'T' separator as a space character is much more readable
@@ -372,5 +377,5 @@
      */
     public static DateTimeFormatter getDateTimeFormatter(FormatStyle dateStyle, FormatStyle timeStyle) {
-        DateTimeFormatter formatter = PROP_ISO_DATES.get()
+        DateTimeFormatter formatter = Boolean.TRUE.equals(PROP_ISO_DATES.get())
                 ? ISO_LOCAL_DATE_TIME
                 : DateTimeFormatter.ofLocalizedDateTime(dateStyle, timeStyle);
