diff options
author | Keith Packard <keithp@keithp.com> | 2011-11-12 18:10:18 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-11-12 18:10:18 -0800 |
commit | f6db11c3c87725c809c518f5f19b07325faf9c84 (patch) | |
tree | 0a78d71cc8589c02ad27b7385fa018b848ea9d3d /altosui/AltosFlashUI.java | |
parent | b132eefc5f63412bb4a98a4bb72b9055e40d5d42 (diff) |
altosui: Deal with serial port exceptions a bit better
This catches a few exceptions and tries to make sure the serial port
is closed afterwards.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosFlashUI.java')
-rw-r--r-- | altosui/AltosFlashUI.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/altosui/AltosFlashUI.java b/altosui/AltosFlashUI.java index 39151641..704ce35c 100644 --- a/altosui/AltosFlashUI.java +++ b/altosui/AltosFlashUI.java @@ -247,7 +247,7 @@ public class AltosFlashUI flash.set_romconfig(ui.rom_config); flash.flash(); } - } catch (Exception ee) { + } catch (InterruptedException ee) { final Exception e = ee; System.out.printf("exception %s\n", e.toString()); SwingUtilities.invokeLater(new Runnable() { @@ -255,9 +255,26 @@ public class AltosFlashUI ui.exception(e); } }); + } catch (IOException ee) { + final Exception e = ee; + System.out.printf("exception %s\n", e.toString()); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + ui.exception(e); + } + }); + } catch (AltosSerialInUseException ee) { + final Exception e = ee; + System.out.printf("exception %s\n", e.toString()); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + ui.exception(e); + } + }); + } finally { + if (flash != null) + flash.close(); } - if (flash != null) - flash.close(); } public flash_task(AltosFlashUI in_ui) { |