diff options
| author | Keith Packard <keithp@keithp.com> | 2011-04-25 22:28:40 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2011-04-25 22:28:40 -0700 | 
| commit | 109344d54d3fa4f79342fd1ea2a3f4085475e30c (patch) | |
| tree | 133662e29d32c1e267b4daeb5e38237383f24233 /altosui/AltosDisplayThread.java | |
| parent | aa5caf6310f074109472e6f55d8bd9751fb75c4c (diff) | |
altosui: Display reader name (usually the device) when an I/O error occurs
Access the reader name directly from the reader object instead of a
local variable (which wasn't getting set anyways).
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosDisplayThread.java')
| -rw-r--r-- | altosui/AltosDisplayThread.java | 12 | 
1 files changed, 5 insertions, 7 deletions
| diff --git a/altosui/AltosDisplayThread.java b/altosui/AltosDisplayThread.java index 84abfae9..ce8d9159 100644 --- a/altosui/AltosDisplayThread.java +++ b/altosui/AltosDisplayThread.java @@ -33,7 +33,6 @@ public class AltosDisplayThread extends Thread {  	Frame			parent;  	IdleThread		idle_thread;  	AltosVoice		voice; -	String			name;  	AltosFlightReader	reader;  	int			crc_errors;  	AltosFlightDisplay	display; @@ -57,19 +56,18 @@ public class AltosDisplayThread extends Thread {  		SwingUtilities.invokeLater(r);  	} -	void reading_error_internal(String name) { +	void reading_error_internal() {  		JOptionPane.showMessageDialog(parent, -					      String.format("Error reading from \"%s\"", name), +					      String.format("Error reading from \"%s\"", reader.name),  					      "Telemetry Read Error",  					      JOptionPane.ERROR_MESSAGE);  	} -	void reading_error_safely(String in_name) { -		final String name = in_name; +	void reading_error_safely() {  		Runnable r = new Runnable() {  				public void run() {  					try { -						reading_error_internal(name); +						reading_error_internal();  					} catch (Exception ex) {  					}  				} @@ -258,7 +256,7 @@ public class AltosDisplayThread extends Thread {  		} catch (InterruptedException ee) {  			interrupted = true;  		} catch (IOException ie) { -			reading_error_safely(name); +			reading_error_safely();  		} finally {  			if (!interrupted)  				idle_thread.report(true); | 
