telegps: use new eeprom reading code
authorBdale Garbee <bdale@gag.com>
Thu, 11 May 2017 04:19:38 +0000 (22:19 -0600)
committerBdale Garbee <bdale@gag.com>
Thu, 11 May 2017 04:20:43 +0000 (22:20 -0600)
telegps/TeleGPS.java

index 66eaaa2..cf2cbd4 100644 (file)
@@ -614,16 +614,23 @@ public class TeleGPS
 
        static AltosStateIterable record_iterable(File file) {
                FileInputStream in;
-               try {
-                       in = new FileInputStream(file);
-               } catch (Exception e) {
-                       System.out.printf("Failed to open file '%s'\n", file);
-                       return null;
-               }
-               if (file.getName().endsWith("telem"))
-                       return new AltosTelemetryFile(in);
-               else
-                       return new AltosEepromFile(in);
+                if (file.getName().endsWith("telem")) {
+                        try {
+                                in = new FileInputStream(file);
+                                return new AltosTelemetryFile(in);
+                        } catch (Exception e) {
+                                System.out.printf("Failed to open file '%s'\n", file);
+                        }
+                } else {
+
+                        try {
+                                AltosEepromFile f = new AltosEepromFile(new FileReader(file));
+                                return f;
+                        } catch (Exception e) {
+                                System.out.printf("Failed to open file '%s'\n", file);
+                        }
+                }
+                return null;
        }
 
        static AltosReplayReader replay_file(File file) {