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