Add early out for cancelled jobs to process() for ingest module pipelines

This commit is contained in:
Richard Cordovano 2015-07-28 10:09:21 -04:00
parent 682d142263
commit b0e488c692
2 changed files with 56 additions and 49 deletions

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2014 Basis Technology Corp.
* Copyright 2014-2015 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -96,6 +96,7 @@ final class DataSourceIngestPipeline {
*/
synchronized List<IngestModuleError> process(DataSourceIngestTask task) {
List<IngestModuleError> errors = new ArrayList<>();
if (!this.job.isCancelled()) {
Content dataSource = task.getDataSource();
for (PipelineModule module : modules) {
try {
@ -113,8 +114,9 @@ final class DataSourceIngestPipeline {
errors.add(new IngestModuleError(module.getDisplayName(), ex));
String msg = ex.getMessage();
// Jython run-time errors don't seem to have a message, but have details in toString.
if (msg == null)
if (msg == null) {
msg = ex.toString();
}
MessageNotifyUtil.Notify.error(module.getDisplayName() + " Error", msg);
}
if (this.job.isCancelled()) {
@ -123,6 +125,7 @@ final class DataSourceIngestPipeline {
this.job.currentDataSourceIngestModuleCancellationCompleted(currentModule.getDisplayName());
}
}
}
this.currentModule = null;
ingestManager.setIngestTaskProgressCompleted(task);
return errors;

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2014 Basis Technology Corp.
* Copyright 2014-2015 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -113,6 +113,7 @@ final class FileIngestPipeline {
*/
synchronized List<IngestModuleError> process(FileIngestTask task) {
List<IngestModuleError> errors = new ArrayList<>();
if (!this.job.isCancelled()) {
AbstractFile file = task.getFile();
for (PipelineModule module : this.modules) {
try {
@ -122,8 +123,9 @@ final class FileIngestPipeline {
errors.add(new IngestModuleError(module.getDisplayName(), ex));
String msg = ex.getMessage();
// Jython run-time errors don't seem to have a message, but have details in toString.
if (msg == null)
if (msg == null) {
msg = ex.toString();
}
MessageNotifyUtil.Notify.error(module.getDisplayName() + " Error", msg);
}
if (this.job.isCancelled()) {
@ -134,6 +136,7 @@ final class FileIngestPipeline {
if (!this.job.isCancelled()) {
IngestManager.getInstance().fireFileIngestDone(file);
}
}
FileIngestPipeline.ingestManager.setIngestTaskProgressCompleted(task);
return errors;
}
@ -153,8 +156,9 @@ final class FileIngestPipeline {
errors.add(new IngestModuleError(module.getDisplayName(), ex));
String msg = ex.getMessage();
// Jython run-time errors don't seem to have a message, but have details in toString.
if (msg == null)
if (msg == null) {
msg = ex.toString();
}
MessageNotifyUtil.Notify.error(module.getDisplayName() + " Error", msg);
}
}