Index: applications/editors/josm/plugins/livegps/src/livegps/LiveGpsAcquirer.java
===================================================================
--- applications/editors/josm/plugins/livegps/src/livegps/LiveGpsAcquirer.java	(revision 36121)
+++ applications/editors/josm/plugins/livegps/src/livegps/LiveGpsAcquirer.java	(revision 36122)
@@ -16,8 +16,9 @@
 import java.util.List;
 
-import javax.json.Json;
-import javax.json.JsonException;
-import javax.json.JsonNumber;
-import javax.json.JsonObject;
+import jakarta.json.Json;
+import jakarta.json.JsonException;
+import jakarta.json.JsonNumber;
+import jakarta.json.JsonObject;
+import jakarta.json.JsonReader;
 
 import org.openstreetmap.josm.spi.preferences.Config;
@@ -28,14 +29,14 @@
  */
 public class LiveGpsAcquirer implements Runnable {
-    private String gpsdHost;
-    private int gpsdPort;
+    private final String gpsdHost;
+    private final int gpsdPort;
 
     private Socket gpsdSocket;
     private BufferedReader gpsdReader;
-    private boolean connected = false;
-    private boolean shutdownFlag = false;
+    private boolean connected;
+    private boolean shutdownFlag;
     private boolean JSONProtocol = true;
-    private long skipTime = 0L;
-    private int skipNum = 0;
+    private long skipTime;
+    private int skipNum;
 
     private final List<PropertyChangeListener> propertyChangeListener = new ArrayList<>();
@@ -122,5 +123,5 @@
     public void run() {
         LiveGpsData oldGpsData = null;
-        LiveGpsData gpsData = null;
+        LiveGpsData gpsData;
 
         shutdownFlag = false;
@@ -131,9 +132,11 @@
                     connect();
                 } catch (IOException iox) {
+                    Logging.trace(iox);
                     fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTION_FAILED, tr("Connection Failed"));
                     try {
                         Thread.sleep(1000);
-                    } catch (InterruptedException ignore) {
-                        Logging.trace(ignore);
+                    } catch (InterruptedException interruptedException) {
+                        Logging.trace(interruptedException);
+                        Thread.currentThread().interrupt();
                     }
                 }
@@ -155,5 +158,5 @@
                     throw new IOException();
 
-                if (JSONProtocol == true)
+                if (JSONProtocol)
                     gpsData = parseJSON(line);
                 else
@@ -173,6 +176,7 @@
                 try {
                     Thread.sleep(1000);
-                } catch (InterruptedException ignore) {
-                    Logging.trace(ignore);
+                } catch (InterruptedException interruptedException) {
+                    Logging.trace(interruptedException);
+                    Thread.currentThread().interrupt();
                 }
                 // send warning to layer
@@ -219,5 +223,5 @@
         }
 
-        if (gpsdSocket == null || gpsdSocket.isConnected() == false) {
+        if (gpsdSocket == null || !gpsdSocket.isConnected()) {
             if (skipTime == 0)
                 skipTime = System.currentTimeMillis()+60000;
@@ -237,8 +241,8 @@
             return;
 
-        try {
-            greeting = Json.createReader(new StringReader(line)).readObject();
+        try (JsonReader reader = Json.createReader(new StringReader(line))) {
+            greeting = reader.readObject();
             type = greeting.getString("class");
-            if (type.equals("VERSION")) {
+            if ("VERSION".equals(type)) {
                 release = greeting.getString("release");
                 Logging.info("LiveGps: Connected to gpsd " + release);
@@ -252,7 +256,8 @@
                 fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTED, tr("Connected"));
             }
-        }
-
-        if (JSONProtocol == true) {
+            Logging.trace(jex);
+        }
+
+        if (JSONProtocol) {
             JsonObject watch = Json.createObjectBuilder()
                     .add("enable", true)
@@ -276,10 +281,11 @@
             gpsdSocket.close();
             gpsdSocket = null;
-        } catch (Exception e) {
+        } catch (IOException e) {
             Logging.warn("LiveGps: Unable to close socket; reconnection may not be possible");
-        }
-    }
-
-    private LiveGpsData parseJSON(String line) {
+            Logging.trace(e);
+        }
+    }
+
+    private static LiveGpsData parseJSON(String line) {
         JsonObject report;
         double lat, lon;
@@ -289,11 +295,12 @@
         float epy = 0;
 
-        try {
-            report = Json.createReader(new StringReader(line)).readObject();
+        try (JsonReader reader = Json.createReader(new StringReader(line))) {
+            report = reader.readObject();
         } catch (JsonException jex) {
             Logging.warn("LiveGps: line read from gpsd is not a JSON object:" + line);
+            Logging.trace(jex);
             return null;
         }
-        if (!report.getString("class").equals("TPV") || report.getInt("mode") < 2)
+        if (!"TPV".equals(report.getString("class")) || report.getInt("mode") < 2)
             return null;
 
@@ -322,13 +329,13 @@
     }
 
-    private LiveGpsData parseOld(String line) {
+    private static LiveGpsData parseOld(String line) {
         String[] words;
-        double lat = 0;
-        double lon = 0;
+        double lat;
+        double lon;
         float speed = 0;
         float course = 0;
 
         words = line.split(",");
-        if ((words.length == 0) || !words[0].equals("GPSD"))
+        if ((words.length == 0) || !"GPSD".equals(words[0]))
             return null;
 
