diff options
author | Keith Packard <keithp@keithp.com> | 2013-12-18 01:14:11 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-12-18 01:14:11 -0800 |
commit | e26306c9350ef1d107d4257ef1c09d15165c9154 (patch) | |
tree | d7983c6a04c54b3307d6fc2699dad4fa21d8bde0 /altoslib/AltosMag.java | |
parent | 18852efa108ba6e6e69dfd5076d4f4c01f62b4ef (diff) |
altoslib: Pass InterruptedException up the stack instead of hiding it
When interrupting a thread that is talking to a serial device, it's
important not to have that thread discard the InterruptedException so
that it will actually terminate. This patch removes a bunch of places
that were discarding InterruptedExceptions and lets higher level code
see them so that they can exit cleanly.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosMag.java')
-rw-r--r-- | altoslib/AltosMag.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/altoslib/AltosMag.java b/altoslib/AltosMag.java index 56add8f3..89e72bd6 100644 --- a/altoslib/AltosMag.java +++ b/altoslib/AltosMag.java @@ -25,6 +25,11 @@ public class AltosMag implements Cloneable { public int z; public boolean parse_string(String line) { +// if (line.startsWith("Syntax error")) { +// x = y = z = 0; +// return true; +// } + if (!line.startsWith("X:")) return false; @@ -53,14 +58,13 @@ public class AltosMag implements Cloneable { z = AltosLib.MISSING; } - static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) { + static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) throws InterruptedException { try { AltosMag mag = new AltosMag(link); if (mag != null) state.set_mag(mag); } catch (TimeoutException te) { - } catch (InterruptedException ie) { } } |