summaryrefslogtreecommitdiff
path: root/altosui
diff options
context:
space:
mode:
Diffstat (limited to 'altosui')
-rw-r--r--altosui/AltosLanded.java7
-rw-r--r--altosui/AltosUI.java10
2 files changed, 11 insertions, 6 deletions
diff --git a/altosui/AltosLanded.java b/altosui/AltosLanded.java
index ded08537..25d4fcc8 100644
--- a/altosui/AltosLanded.java
+++ b/altosui/AltosLanded.java
@@ -125,7 +125,7 @@ public class AltosLanded extends AltosUIFlightTab implements ActionListener {
try {
AltosStateIterable states = null;
if (filename.endsWith("eeprom")) {
- FileInputStream in = new FileInputStream(file);
+ FileReader in = new FileReader(file);
states = new AltosEepromFile(in);
} else if (filename.endsWith("telem")) {
FileInputStream in = new FileInputStream(file);
@@ -143,6 +143,11 @@ public class AltosLanded extends AltosUIFlightTab implements ActionListener {
fe.getMessage(),
"Cannot open file",
JOptionPane.ERROR_MESSAGE);
+ } catch (IOException ie) {
+ JOptionPane.showMessageDialog(null,
+ ie.getMessage(),
+ "Error reading file file",
+ JOptionPane.ERROR_MESSAGE);
}
}
}
diff --git a/altosui/AltosUI.java b/altosui/AltosUI.java
index b0c6d33b..72c3c161 100644
--- a/altosui/AltosUI.java
+++ b/altosui/AltosUI.java
@@ -367,16 +367,16 @@ public class AltosUI extends AltosUIFrame {
static AltosStateIterable open_logfile(File file) {
try {
- FileInputStream in;
-
- in = new FileInputStream(file);
if (file.getName().endsWith("telem"))
- return new AltosTelemetryFile(in);
+ return new AltosTelemetryFile(new FileInputStream(file));
else
- return new AltosEepromFile(in);
+ return new AltosEepromFile(new FileReader(file));
} catch (FileNotFoundException fe) {
System.out.printf("%s\n", fe.getMessage());
return null;
+ } catch (IOException ie) {
+ System.out.printf("%s\n", ie.getMessage());
+ return null;
}
}