Index: /trunk/src/org/openstreetmap/josm/gui/widgets/DateEditorWithSlider.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/widgets/DateEditorWithSlider.java	(revision 19538)
+++ /trunk/src/org/openstreetmap/josm/gui/widgets/DateEditorWithSlider.java	(revision 19539)
@@ -27,4 +27,5 @@
  * @since 5815
  */
+@SuppressWarnings("PMD.ReplaceJavaUtilDate") // JSpinner needs Date anyway, so not using Date makes no sense
 public class DateEditorWithSlider extends JPanel {
     private final JSpinner spinner;
Index: /trunk/src/org/openstreetmap/josm/io/nmea/NmeaParser.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/nmea/NmeaParser.java	(revision 19538)
+++ /trunk/src/org/openstreetmap/josm/io/nmea/NmeaParser.java	(revision 19539)
@@ -3,15 +3,16 @@
 
 import java.nio.charset.StandardCharsets;
-import java.text.ParsePosition;
-import java.text.SimpleDateFormat;
 import java.time.Instant;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.DateTimeParseException;
+import java.time.format.ResolverStyle;
+import java.time.temporal.ChronoField;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Date;
 import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -20,5 +21,4 @@
 import org.openstreetmap.josm.io.IllegalDataException;
 import org.openstreetmap.josm.tools.Logging;
-import org.openstreetmap.josm.tools.date.DateUtils;
 
 /**
@@ -180,26 +180,17 @@
     }
 
-    private static final Pattern DATE_TIME_PATTERN = Pattern.compile("(\\d{12})(\\.\\d+)?");
-
-    private final SimpleDateFormat rmcTimeFmt = new SimpleDateFormat("ddMMyyHHmmss.SSS", Locale.ENGLISH);
-
-    private Instant readTime(String p) throws IllegalDataException {
-        // NMEA defines time with "a variable number of digits for decimal-fraction of seconds"
-        // This variable decimal fraction cannot be parsed by SimpleDateFormat
-        Matcher m = DATE_TIME_PATTERN.matcher(p);
-        if (m.matches()) {
-            String date = m.group(1);
-            double milliseconds = 0d;
-            if (m.groupCount() > 1 && m.group(2) != null) {
-                milliseconds = 1000d * Double.parseDouble("0" + m.group(2));
-            }
-            // Add milliseconds on three digits to match SimpleDateFormat pattern
-            date += String.format(".%03d", (int) milliseconds);
-            Date d = rmcTimeFmt.parse(date, new ParsePosition(0));
-            if (d != null)
-                return d.toInstant();
-        }
-        throw new IllegalDataException("Date is malformed: '" + p + "'");
-    }
+    /**
+     * NMEA defines time with "a variable number of digits for decimal-fraction of seconds"
+     */
+    private static final DateTimeFormatter RMC_TIME_FMT =
+        new DateTimeFormatterBuilder()
+                .appendPattern("ddMMyyHHmmss")
+                .optionalStart()
+                .appendFraction(ChronoField.NANO_OF_SECOND, 1, 9, true)
+                .optionalEnd()
+                .toFormatter(Locale.ENGLISH)
+                .withZone(ZoneOffset.UTC)
+                /* allow bad date information, we're mainly interested in the positions */
+                .withResolverStyle(ResolverStyle.LENIENT);
 
     protected Collection<WayPoint> waypoints = new ArrayList<>();
@@ -291,5 +282,4 @@
      */
     public NmeaParser() {
-        rmcTimeFmt.setTimeZone(DateUtils.UTC);
         pDate = "010100"; // TODO date problem
     }
@@ -366,5 +356,5 @@
                 // time
                 accu = e[GGA.TIME.position];
-                Instant instant = readTime(currentDate+accu);
+                Instant instant = Instant.from(RMC_TIME_FMT.parse(currentDate+accu));
 
                 if ((pTime == null) || (currentwp == null) || !pTime.equals(accu)) {
@@ -523,5 +513,5 @@
                 String time = e[RMC.TIME.position];
 
-                Instant instant = readTime(currentDate+time);
+                Instant instant = Instant.from(RMC_TIME_FMT.parse(currentDate+time));
 
                 if (pTime == null || currentwp == null || !pTime.equals(time)) {
@@ -590,5 +580,5 @@
             return true;
 
-        } catch (IllegalArgumentException | IndexOutOfBoundsException | IllegalDataException ex) {
+        } catch (IllegalArgumentException | IndexOutOfBoundsException | IllegalDataException | DateTimeParseException ex) {
             if (malformed < 5) {
                 Logging.warn(ex);
Index: /trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java	(revision 19538)
+++ /trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java	(revision 19539)
@@ -11,6 +11,8 @@
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.Collection;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Locale;
@@ -453,5 +455,5 @@
             boolean endHeaders) throws IOException {
         out.write("HTTP/1.1 " + status + "\r\n");
-        out.write("Date: " + new Date() + "\r\n");
+        out.write("Date: " + DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.now(ZoneOffset.UTC)) + "\r\n");
         out.write("Server: " + JOSM_REMOTE_CONTROL + "\r\n");
         out.write("Content-type: " + contentType + "; charset=" + RESPONSE_CHARSET.name().toLowerCase(Locale.ENGLISH) + "\r\n");
Index: /trunk/src/org/openstreetmap/josm/tools/ColorScale.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/ColorScale.java	(revision 19538)
+++ /trunk/src/org/openstreetmap/josm/tools/ColorScale.java	(revision 19539)
@@ -9,5 +9,4 @@
 import java.awt.Font;
 import java.util.Arrays;
-import java.util.Date;
 import java.time.ZoneId;
 import java.time.Instant;
@@ -489,8 +488,5 @@
             } else {
                 final double val = minVal + i * (maxVal - minVal) / intervalCount;
-                final long longval = (long) val;
-
-                final Date date = new Date(longval * 1000L);
-                final Instant dateInst = date.toInstant();
+                final Instant dateInst = Instant.ofEpochSecond((long) val);
 
                 final ZoneId gmt = ZoneId.of("GMT");
Index: /trunk/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java	(revision 19538)
+++ /trunk/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java	(revision 19539)
@@ -84,10 +84,10 @@
     }
     
-    private static void compareWithReference(int ticket, String filename, int numCoor) throws IOException, SAXException {
+    private static void compareWithReference(int ticket, String filename, int numCoor, int parseErrors) throws IOException, SAXException {
         GpxData gpx = GpxReaderTest.parseGpxData(TestUtils.getRegressionDataFile(ticket, filename+".gpx"));
         NmeaReader in = new NmeaReader(Files.newInputStream(Paths.get(TestUtils.getRegressionDataFile(ticket, filename+".nmea"))));
         in.parse(true);
         assertEquals(numCoor, in.getNumberOfCoordinates());
-        assertEquals(0, in.getParserMalformed());
+        assertEquals(parseErrors, in.getParserMalformed());
         assertEquals(gpx.dataSources, in.data.dataSources);
         assertEquals(1, gpx.tracks.size());
@@ -129,14 +129,16 @@
     @Test
     void testTicket1433() throws Exception {
-        compareWithReference(1433, "2008-08-14-16-04-58", 1241);
+        compareWithReference(1433, "2008-08-14-16-04-58", 1241, 0);
     }
 
     /**
      * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/1853">Bug #1853</a>.
+     * date format is wrong, so RMC lines get ignored
      * @throws Exception if an error occurs
      */
     @Test
     void testTicket1853() throws Exception {
-        compareWithReference(1853, "PosData-20081216-115434", 1285);
+        /* last argument must be 1285 if RMC_TIME_FMT is not using .withResolverStyle(ResolverStyle.LENIENT) */
+        compareWithReference(1853, "PosData-20081216-115434", 1285, 0);
     }
 
@@ -147,5 +149,5 @@
     @Test
     void testTicket2147() throws Exception {
-        compareWithReference(2147, "WG20080203171807.log", 487);
+        compareWithReference(2147, "WG20080203171807.log", 487, 0);
     }
 
@@ -156,5 +158,5 @@
     @Test
     void testTicket14924() throws Exception {
-        compareWithReference(14924, "input", 0);
+        compareWithReference(14924, "input", 0, 0);
     }
 
