Generalize error-catching of motor file loading

This commit is contained in:
SiboVG 2022-12-24 04:30:13 +01:00
parent a0ea15a094
commit 1fafe0b181
2 changed files with 6 additions and 6 deletions

View File

@ -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);

View File

@ -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;
}