altosui: When parsing saved telem files, errors shouldn't abort file
authorKeith Packard <keithp@keithp.com>
Fri, 27 Aug 2010 06:53:06 +0000 (23:53 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 27 Aug 2010 06:53:06 +0000 (23:53 -0700)
Make syntax errors in telem files just skip the current line and move
on to the next one instead of abandoning the whole file.

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/altosui/AltosTelemetryReader.java

index f1f6788c0afbc17973574a0b98c5459647d153a8..a3402f9c8b85a1756809ed2f879009fcb37b4294 100644 (file)
@@ -47,20 +47,25 @@ public class AltosTelemetryReader extends AltosReader {
                try {
                        for (;;) {
                                String line = AltosRecord.gets(input);
-                               if (line == null)
+                               if (line == null) {
                                        break;
-                               AltosTelemetry record = new AltosTelemetry(line);
-                               if (record == null)
-                                       break;
-                               if (!saw_boost && record.state >= Altos.ao_flight_boost)
-                               {
-                                       saw_boost = true;
-                                       boost_tick = record.tick;
                                }
-                               records.add(record);
+                               try {
+                                       AltosTelemetry record = new AltosTelemetry(line);
+                                       if (record == null)
+                                               break;
+                                       if (!saw_boost && record.state >= Altos.ao_flight_boost)
+                                       {
+                                               saw_boost = true;
+                                               boost_tick = record.tick;
+                                       }
+                                       records.add(record);
+                               } catch (ParseException pe) {
+                                       System.out.printf("parse exception %s\n", pe.getMessage());
+                               }
                        }
                } catch (IOException io) {
-               } catch (ParseException pe) {
+                       System.out.printf("io exception\n");
                }
                record_iterator = records.iterator();
                try {