summaryrefslogtreecommitdiff
path: root/altosui
diff options
context:
space:
mode:
Diffstat (limited to 'altosui')
-rw-r--r--altosui/AltosBTManage.java20
-rw-r--r--altosui/AltosConfig.java2
-rw-r--r--altosui/AltosFlashUI.java8
-rw-r--r--altosui/AltosIdleMonitorUI.java14
-rw-r--r--altosui/AltosSerial.java8
5 files changed, 35 insertions, 17 deletions
diff --git a/altosui/AltosBTManage.java b/altosui/AltosBTManage.java
index 4c9b7a6c..1015f7c3 100644
--- a/altosui/AltosBTManage.java
+++ b/altosui/AltosBTManage.java
@@ -85,7 +85,7 @@ public class AltosBTManage extends AltosUIDialog implements ActionListener, Iter
return devices.iterator();
}
- public java.util.List<AltosBTDevice> selected_list() {
+ public java.util.List<AltosBTDevice> selected_list() throws InterruptedException {
java.util.LinkedList<AltosBTDevice> l = new java.util.LinkedList<AltosBTDevice>();
Object[] a = getSelectedValues();
for (int i = 0; i < a.length; i++)
@@ -117,16 +117,22 @@ public class AltosBTManage extends AltosUIDialog implements ActionListener, Iter
}
public void add_known() {
- for (AltosBTDevice device : visible_devices.selected_list()) {
- known_devices.add(device);
- visible_devices.remove(device);
+ try {
+ for (AltosBTDevice device : visible_devices.selected_list()) {
+ known_devices.add(device);
+ visible_devices.remove(device);
+ }
+ } catch (InterruptedException ie) {
}
}
public void remove_known() {
- for (AltosBTDevice device : known_devices.selected_list()) {
- known_devices.remove(device);
- visible_devices.add(device);
+ try {
+ for (AltosBTDevice device : known_devices.selected_list()) {
+ known_devices.remove(device);
+ visible_devices.add(device);
+ }
+ } catch (InterruptedException ie) {
}
}
diff --git a/altosui/AltosConfig.java b/altosui/AltosConfig.java
index a6e6094f..206cbee3 100644
--- a/altosui/AltosConfig.java
+++ b/altosui/AltosConfig.java
@@ -161,9 +161,9 @@ public class AltosConfig implements ActionListener {
} finally {
try {
stop_serial();
+ serial_line.close();
} catch (InterruptedException ie) {
}
- serial_line.close();
}
}
diff --git a/altosui/AltosFlashUI.java b/altosui/AltosFlashUI.java
index e305d458..296ad8ef 100644
--- a/altosui/AltosFlashUI.java
+++ b/altosui/AltosFlashUI.java
@@ -365,7 +365,7 @@ public class AltosFlashUI
flash_task flasher;
- private boolean open_device() {
+ private boolean open_device() throws InterruptedException {
try {
link = new AltosSerial(device);
if (is_pair_programmed())
@@ -408,8 +408,12 @@ public class AltosFlashUI
return;
if (!select_source_file())
return;
- if (!open_device())
+ try {
+ if (!open_device())
+ return;
+ } catch (InterruptedException ie) {
return;
+ }
build_dialog();
flash_task f = new flash_task(this);
}
diff --git a/altosui/AltosIdleMonitorUI.java b/altosui/AltosIdleMonitorUI.java
index f4e16243..6da920e2 100644
--- a/altosui/AltosIdleMonitorUI.java
+++ b/altosui/AltosIdleMonitorUI.java
@@ -23,6 +23,7 @@ import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
import java.util.concurrent.*;
+import java.util.Arrays;
import org.altusmetrum.altoslib_2.*;
import org.altusmetrum.altosuilib_1.*;
@@ -38,7 +39,10 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
void stop_display() {
if (thread != null) {
- thread.abort();
+ try {
+ thread.abort();
+ } catch (InterruptedException ie) {
+ }
}
thread = null;
}
@@ -191,7 +195,13 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
- disconnect();
+ System.out.printf("Closing idle monitor window\n");
+ try {
+ disconnect();
+ } catch (Exception ex) {
+ System.out.println(Arrays.toString(ex.getStackTrace()));
+ }
+ System.out.printf("hiding\n");
setVisible(false);
dispose();
AltosUIPreferences.unregister_font_listener(AltosIdleMonitorUI.this);
diff --git a/altosui/AltosSerial.java b/altosui/AltosSerial.java
index b85a7fa1..5e9322e5 100644
--- a/altosui/AltosSerial.java
+++ b/altosui/AltosSerial.java
@@ -146,7 +146,7 @@ public class AltosSerial extends AltosLink {
try {
input_thread.interrupt();
input_thread.join();
- } catch (InterruptedException e) {
+ } catch (InterruptedException ie) {
}
input_thread = null;
}
@@ -156,18 +156,16 @@ public class AltosSerial extends AltosLink {
private void putc(char c) {
if (altos != null)
- if (libaltos.altos_putchar(altos, c) != 0) {
+ if (libaltos.altos_putchar(altos, c) != 0)
close_serial();
- }
}
public void putchar(byte c) {
if (altos != null) {
if (debug)
System.out.printf(" %02x", (int) c & 0xff);
- if (libaltos.altos_putchar(altos, (char) c) != 0) {
+ if (libaltos.altos_putchar(altos, (char) c) != 0)
close_serial();
- }
}
}