Generalize error-catching of motor file loading
This commit is contained in:
parent
a0ea15a094
commit
1fafe0b181
@ -44,7 +44,7 @@ public class ZipFileMotorLoader implements MotorLoader {
|
||||
|
||||
|
||||
@Override
|
||||
public List<ThrustCurveMotor.Builder> load(InputStream stream, String filename) throws IOException {
|
||||
public List<ThrustCurveMotor.Builder> load(InputStream stream, String filename) throws IOException, IllegalArgumentException {
|
||||
List<ThrustCurveMotor.Builder> motors = new ArrayList<>();
|
||||
|
||||
ZipInputStream is = new ZipInputStream(stream);
|
||||
|
@ -127,8 +127,8 @@ public class MotorDatabaseLoader extends AsynchronousDatabaseLoader {
|
||||
new Pair<String,InputStream>(
|
||||
file.getName(),
|
||||
new BufferedInputStream(new FileInputStream(file))));
|
||||
} catch (IOException e) {
|
||||
log.warn("IOException while reading " + file + ": " + e, e);
|
||||
} catch (Exception e) {
|
||||
log.warn("Exception while reading " + file + ": " + e, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,8 +158,8 @@ public class MotorDatabaseLoader extends AsynchronousDatabaseLoader {
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
f.getV().close();
|
||||
} catch (IOException e) {
|
||||
log.warn("IOException while loading file " + f.getU() + ": " + e, e);
|
||||
} catch (Exception e) {
|
||||
log.warn("Exception while loading file " + f.getU() + ": " + e, e);
|
||||
try {
|
||||
f.getV().close();
|
||||
} catch (IOException e1) {
|
||||
@ -178,7 +178,7 @@ public class MotorDatabaseLoader extends AsynchronousDatabaseLoader {
|
||||
FileIterator iterator;
|
||||
try {
|
||||
iterator = new DirectoryIterator(file, fileFilter, true);
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
log.warn("Unable to read directory " + file + ": " + e, e);
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user