*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_8;
+package org.altusmetrum.altoslib_11;
import java.io.*;
import java.util.*;
AltosEepromList flights;
boolean success;
- ParseException parse_exception;
+ String parse_errors;
AltosState state;
private void FlushPending() throws IOException {
}
}
+ void LogError(String error) {
+ if (parse_errors != null)
+ parse_errors.concat(error.concat("\n"));
+ else
+ parse_errors = error;
+ }
+
void CaptureEeprom(AltosEepromChunk eechunk, int log_format) throws IOException, ParseException {
boolean any_valid = false;
boolean got_flight = false;
monitor.set_serial(flights.config_data.serial);
for (int i = 0; i < AltosEepromChunk.chunk_size && !done; i += record_length) {
- AltosEeprom r = eechunk.eeprom(i, log_format, state);
+ AltosEeprom r = null;
+
+ try {
+ r = eechunk.eeprom(i, log_format, state);
+ } catch (ParseException pe) {
+ LogError(pe.getMessage());
+ r = null;
+ }
if (r == null)
continue;
link.start_remote();
for (AltosEepromLog log : flights) {
- parse_exception = null;
+ parse_errors = null;
if (log.selected) {
monitor.reset();
eeprom_file = null;
try {
CaptureLog(log);
} catch (ParseException e) {
- parse_exception = e;
+ LogError(e.getMessage());
}
if (eeprom_file != null) {
eeprom_file.flush();
eeprom_file.close();
}
}
- if (parse_exception != null) {
+ if (parse_errors != null) {
failed = true;
- monitor.show_message(String.format("Flight %d download error\n%s\nValid log data saved",
+ monitor.show_message(String.format("Flight %d download error. Valid log data saved\n%s",
log.flight,
- parse_exception.getMessage()),
+ parse_errors),
link.name,
AltosEepromMonitor.WARNING_MESSAGE);
}