Index: build.xml
===================================================================
--- build.xml	(revision 35895)
+++ build.xml	(working copy)
@@ -4,7 +4,7 @@
     <!-- enter the SVN commit message -->
     <property name="commit.message" value=""/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-    <property name="plugin.main.version" value="14153"/>
+    <property name="plugin.main.version" value="17715"/>
 
     <property name="plugin.author" value="Paul Hartmann"/>
     <property name="plugin.class" value="org.openstreetmap.josm.plugins.photo_geotagging.GeotaggingPlugin"/>
Index: src/org/openstreetmap/josm/plugins/photo_geotagging/ExifGPSTagger.java
===================================================================
--- src/org/openstreetmap/josm/plugins/photo_geotagging/ExifGPSTagger.java	(revision 35895)
+++ src/org/openstreetmap/josm/plugins/photo_geotagging/ExifGPSTagger.java	(working copy)
@@ -8,6 +8,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.text.DecimalFormat;
+import java.time.Instant;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
@@ -42,7 +43,7 @@
      * @param lossy whether to use lossy approach when writing metadata (overwriting unknown tags)
      * @throws IOException in case of I/O error
      */
-    public static void setExifGPSTag(File imageFile, File dst, double lat, double lon, Date gpsTime, Double speed, Double ele, Double imgDir, boolean lossy) throws IOException {
+    public static void setExifGPSTag(File imageFile, File dst, double lat, double lon, Instant gpsTime, Double speed, Double ele, Double imgDir, boolean lossy) throws IOException {
         try {
             setExifGPSTagWorker(imageFile, dst, lat, lon, gpsTime, speed, ele, imgDir, lossy);
         } catch (ImageReadException ire) {
@@ -52,7 +53,7 @@
         }
     }
 
-    public static void setExifGPSTagWorker(File imageFile, File dst, double lat, double lon, Date gpsTime, Double speed, Double ele, Double imgDir, boolean lossy)
+    public static void setExifGPSTagWorker(File imageFile, File dst, double lat, double lon, Instant gpsTime, Double speed, Double ele, Double imgDir, boolean lossy)
             throws IOException, ImageReadException, ImageWriteException {
 
         TiffOutputSet outputSet = null;
@@ -77,7 +78,7 @@
 
         if (gpsTime != null) {
             Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
-            calendar.setTime(gpsTime);
+            calendar.setTimeInMillis(gpsTime.toEpochMilli());
 
             final int year =   calendar.get(Calendar.YEAR);
             final int month =  calendar.get(Calendar.MONTH) + 1;
Index: src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingAction.java
===================================================================
--- src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingAction.java	(revision 35895)
+++ src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingAction.java	(working copy)
@@ -14,6 +14,7 @@
 import java.nio.file.Files;
 import java.nio.file.NoSuchFileException;
 import java.text.DecimalFormat;
+import java.time.Instant;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -55,7 +56,6 @@
  */
 class GeotaggingAction extends AbstractAction implements LayerAction {
 
-    final static boolean debug = false;
     final static String KEEP_BACKUP = "plugins.photo_geotagging.keep_backup";
     final static String CHANGE_MTIME = "plugins.photo_geotagging.change-mtime";
     final static String MTIME_MODE = "plugins.photo_geotagging.mtime-mode";
@@ -168,9 +168,8 @@
 
         int result = new ExtendedDialog(
                 MainApplication.getMainFrame(),
-                tr("Photo Geotagging Plugin"),
-                new String[] {tr("OK"), tr("Cancel")})
-            .setButtonIcons(new String[] {"ok", "cancel"})
+                tr("Photo Geotagging Plugin"), tr("OK"), tr("Cancel"))
+            .setButtonIcons("ok", "cancel")
             .setContent(cont)
             .setCancelButton(2)
             .setDefaultButton(1)
@@ -284,9 +283,7 @@
                 if (canceled)
                     return exifFailedEntries;
                 ImageEntry e = entries.get(currentIndex);
-                if (debug) {
-                    System.err.print("i:" + currentIndex + " " + e.getFile().getName() + " ");
-                }
+                Logging.trace("photo_geotagging: GeotaggingAction: i: {0} {1} ", currentIndex, e.getFile().getName());
                 try {
                     processEntry(e, lossy);
                 } catch (final IOException ioe) {
@@ -335,9 +332,7 @@
 
                 progressMonitor.subTask(tr("Writing position information to image files... Estimated time left: {0}", timeLeft));
 
-                if (debug) {
-                    System.err.println("finished " + e.getFile());
-                }
+                Logging.trace("photo_geotagging: GeotaggingAction: finished {0}", e.getFile());
                 currentIndex++;
             }
             return exifFailedEntries;
@@ -352,25 +347,21 @@
                 testMTimeReadAndWrite(e.getFile());
             }
 
-            Long mTime = null;
+            Instant mTime = null;
             if (mTimeMode == MTIME_MODE_GPS) {
                 // check GPS time fields, do nothing if all fails
-                Date time;
                 if (e.hasGpsTime()) {
-                    time = e.getGpsTime();
-                } else {
-                    time = e.getExifGpsTime();
+                    mTime = e.getGpsInstant();
+                } else if (e.hasExifGpsTime()) {
+                    mTime = e.getExifGpsInstant();
                 }
-                if (time != null) {
-                    mTime = time.getTime();
-                }
             }
             if ( mTimeMode == MTIME_MODE_PREVIOUS_VALUE
                  // this is also the fallback if one of the other
                  // modes failed to determine the modification time
                  || (mTimeMode != 0 && mTime == null)) {
-                mTime = e.getFile().lastModified();
-                if (mTime.equals(0L))
+                mTime = Instant.ofEpochMilli(e.getFile().lastModified());
+                if (Instant.EPOCH.equals(mTime))
                     throw new IOException(tr("Could not read mtime."));
             }
 
@@ -377,10 +368,10 @@
             chooseFiles(e.getFile());
             if (canceled) return;
             ExifGPSTagger.setExifGPSTag(fileFrom, fileTo, e.getPos().lat(), e.getPos().lon(),
-                    e.getGpsTime(), e.getSpeed(), e.getElevation(), e.getExifImgDir(), lossy);
+                    e.getGpsInstant(), e.getSpeed(), e.getElevation(), e.getExifImgDir(), lossy);
 
             if (mTime != null) {
-                if (!fileTo.setLastModified(mTime))
+                if (!fileTo.setLastModified(mTime.toEpochMilli()))
                     throw new IOException(tr("Could not write mtime."));
             }
 
@@ -389,9 +380,7 @@
         }
 
         private void chooseFiles(File file) throws IOException {
-            if (debug) {
-                System.err.println("f: "+file.getAbsolutePath());
-            }
+            Logging.trace("photo_geotagging: GeotaggingAction: f: "+file.getAbsolutePath());
 
             if (!keep_backup) {
                 chooseFilesNoBackup(file);
@@ -431,9 +420,7 @@
             do {
                 fileTmp = new File(file.getParentFile(), "img" + UUID.randomUUID() + ".tmp");
             } while (fileTmp.exists());
-            if (debug) {
-                System.err.println("TMP: "+fileTmp.getAbsolutePath());
-            }
+            Logging.trace("photo_geotagging: GeotaggingAction: TMP: {0}", fileTmp.getAbsolutePath());
             try {
                 Files.move(file.toPath(), fileTmp.toPath());
             } catch (IOException e) {
@@ -454,9 +441,9 @@
                     l.setIcon(UIManager.getIcon("OptionPane.warningIcon"));
                     int override = new ExtendedDialog(
                             progressMonitor.getWindowParent(),
-                            tr("Override old backup files?"),
-                            new String[] {tr("Cancel"), tr("Keep old backups and continue"), tr("Override")})
-                        .setButtonIcons(new String[] {"cancel", "ok", "dialogs/delete"})
+                            tr("Override old backup files?"), tr("Cancel"), tr("Keep old backups and continue"),
+                            tr("Override"))
+                        .setButtonIcons("cancel", "ok", "dialogs/delete")
                         .setContent(l)
                         .setCancelButton(1)
                         .setDefaultButton(2)
@@ -471,7 +458,7 @@
                     }
                 });
             } catch (Exception e) {
-                System.err.println(e);
+                Logging.error(e);
                 canceled = true;
             }
         }
Index: test/unit/org/openstreetmap/josm/plugins/photo_geotagging/ExifGPSTaggerTest.java
===================================================================
--- test/unit/org/openstreetmap/josm/plugins/photo_geotagging/ExifGPSTaggerTest.java	(revision 35895)
+++ test/unit/org/openstreetmap/josm/plugins/photo_geotagging/ExifGPSTaggerTest.java	(working copy)
@@ -1,10 +1,12 @@
 package org.openstreetmap.josm.plugins.photo_geotagging;
 
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.util.Date;
+import java.time.Instant;
 import java.util.Scanner;
 
 import org.apache.commons.imaging.Imaging;
@@ -12,37 +14,39 @@
 import org.apache.commons.imaging.formats.jpeg.exif.ExifRewriter;
 import org.apache.commons.imaging.formats.tiff.TiffImageMetadata;
 import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 import org.openstreetmap.josm.TestUtils;
 
-public class ExifGPSTaggerTest {
+class ExifGPSTaggerTest {
 
-    @Rule
-    public final TemporaryFolder tempFolder = new TemporaryFolder();
+    @TempDir
+    File tempFolder;
 
     @Test
-    public void testTicket11757() throws Exception {
+    void testTicket11757() {
         final File in = new File(TestUtils.getTestDataRoot(), "_DSC1234.jpg");
-        ExifGPSTagger.setExifGPSTag(in, tempFolder.newFile(), 12, 34, new Date(), 12.34, Math.E, Math.PI, true);
+        final File out = new File(tempFolder, in.getName());
+        assertDoesNotThrow(() -> ExifGPSTagger.setExifGPSTag(in, out, 12, 34, Instant.now(), 12.34, Math.E, Math.PI, true));
     }
 
     @Test
-    public void testTicket11757WriteWithoutChange() throws Exception {
+    void testTicket11757WriteWithoutChange() throws Exception {
         final File in = new File(TestUtils.getTestDataRoot(), "_DSC1234.jpg");
+        final long lastModified = in.lastModified();
         final TiffImageMetadata exif = ((JpegImageMetadata) Imaging.getMetadata(in)).getExif();
         final TiffOutputSet outputSet = exif.getOutputSet();
         new ExifRewriter().updateExifMetadataLossless(in, new ByteArrayOutputStream(), outputSet);
+        assertEquals(lastModified, in.lastModified());
     }
 
     @Test
-    @Ignore("To enable after https://josm.openstreetmap.de/ticket/11902 is fixed")
-    public void testTicket11902() throws Exception {
+    @Disabled("To enable after https://josm.openstreetmap.de/ticket/11902 is fixed")
+    void testTicket11902() throws Exception {
         final File in = new File(TestUtils.getTestDataRoot(), "IMG_7250_small.JPG");
-        final File out = tempFolder.newFile();
-        ExifGPSTagger.setExifGPSTag(in, out, 12, 34, new Date(), 12.34, Math.E, Math.PI, false);
+        final File out = new File(tempFolder, in.getName());
+        ExifGPSTagger.setExifGPSTag(in, out, 12, 34, Instant.now(), 12.34, Math.E, Math.PI, false);
         final Process jhead = Runtime.getRuntime().exec(new String[]{"jhead", out.getAbsolutePath()});
         final String stdout = new Scanner(jhead.getErrorStream()).useDelimiter("\\A").next();
         System.out.println(stdout);
Index: test/unit/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingActionTest.java
===================================================================
--- test/unit/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingActionTest.java	(revision 35895)
+++ test/unit/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingActionTest.java	(working copy)
@@ -1,7 +1,5 @@
 package org.openstreetmap.josm.plugins.photo_geotagging;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 
 import java.io.File;
 import java.io.IOException;
@@ -10,16 +8,19 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.gui.layer.geoimage.ImageEntry;
 import org.openstreetmap.josm.plugins.photo_geotagging.GeotaggingAction.GeoTaggingRunnable;
 
-public class GeotaggingActionTest {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
+class GeotaggingActionTest {
+
     @Test
-    public void testProcessEntries() throws IOException {
+    void testProcessEntries() throws IOException {
         File original = new File(TestUtils.getTestDataRoot(), "_DSC1234.jpg");
         assertTrue(original.exists());
 
