mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-20 03:24:55 +00:00
Add early out for cancelled jobs to process() for ingest module pipelines
This commit is contained in:
parent
682d142263
commit
b0e488c692
@ -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,31 +96,34 @@ final class DataSourceIngestPipeline {
|
||||
*/
|
||||
synchronized List<IngestModuleError> process(DataSourceIngestTask task) {
|
||||
List<IngestModuleError> errors = new ArrayList<>();
|
||||
Content dataSource = task.getDataSource();
|
||||
for (PipelineModule module : modules) {
|
||||
try {
|
||||
this.currentModule = module;
|
||||
String displayName = NbBundle.getMessage(this.getClass(),
|
||||
"IngestJob.progress.dataSourceIngest.displayName",
|
||||
module.getDisplayName(), dataSource.getName());
|
||||
this.job.updateDataSourceIngestProgressBarDisplayName(displayName);
|
||||
this.job.switchDataSourceIngestProgressBarToIndeterminate();
|
||||
DataSourceIngestPipeline.ingestManager.setIngestTaskProgress(task, module.getDisplayName());
|
||||
logger.log(Level.INFO, "{0} analysis of {1} (jobId={2}) starting", new Object[]{module.getDisplayName(), this.job.getDataSource().getName(), this.job.getDataSource().getId()});
|
||||
module.process(dataSource, new DataSourceIngestModuleProgress(this.job));
|
||||
logger.log(Level.INFO, "{0} analysis of {1} (jobId={2}) finished", new Object[]{module.getDisplayName(), this.job.getDataSource().getName(), this.job.getDataSource().getId()});
|
||||
} catch (Throwable ex) { // Catch-all exception firewall
|
||||
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)
|
||||
msg = ex.toString();
|
||||
MessageNotifyUtil.Notify.error(module.getDisplayName() + " Error", msg);
|
||||
}
|
||||
if (this.job.isCancelled()) {
|
||||
break;
|
||||
} else if (this.job.currentDataSourceIngestModuleIsCancelled()) {
|
||||
this.job.currentDataSourceIngestModuleCancellationCompleted(currentModule.getDisplayName());
|
||||
if (!this.job.isCancelled()) {
|
||||
Content dataSource = task.getDataSource();
|
||||
for (PipelineModule module : modules) {
|
||||
try {
|
||||
this.currentModule = module;
|
||||
String displayName = NbBundle.getMessage(this.getClass(),
|
||||
"IngestJob.progress.dataSourceIngest.displayName",
|
||||
module.getDisplayName(), dataSource.getName());
|
||||
this.job.updateDataSourceIngestProgressBarDisplayName(displayName);
|
||||
this.job.switchDataSourceIngestProgressBarToIndeterminate();
|
||||
DataSourceIngestPipeline.ingestManager.setIngestTaskProgress(task, module.getDisplayName());
|
||||
logger.log(Level.INFO, "{0} analysis of {1} (jobId={2}) starting", new Object[]{module.getDisplayName(), this.job.getDataSource().getName(), this.job.getDataSource().getId()});
|
||||
module.process(dataSource, new DataSourceIngestModuleProgress(this.job));
|
||||
logger.log(Level.INFO, "{0} analysis of {1} (jobId={2}) finished", new Object[]{module.getDisplayName(), this.job.getDataSource().getName(), this.job.getDataSource().getId()});
|
||||
} catch (Throwable ex) { // Catch-all exception firewall
|
||||
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) {
|
||||
msg = ex.toString();
|
||||
}
|
||||
MessageNotifyUtil.Notify.error(module.getDisplayName() + " Error", msg);
|
||||
}
|
||||
if (this.job.isCancelled()) {
|
||||
break;
|
||||
} else if (this.job.currentDataSourceIngestModuleIsCancelled()) {
|
||||
this.job.currentDataSourceIngestModuleCancellationCompleted(currentModule.getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
this.currentModule = null;
|
||||
|
@ -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,26 +113,29 @@ final class FileIngestPipeline {
|
||||
*/
|
||||
synchronized List<IngestModuleError> process(FileIngestTask task) {
|
||||
List<IngestModuleError> errors = new ArrayList<>();
|
||||
AbstractFile file = task.getFile();
|
||||
for (PipelineModule module : this.modules) {
|
||||
try {
|
||||
FileIngestPipeline.ingestManager.setIngestTaskProgress(task, module.getDisplayName());
|
||||
module.process(file);
|
||||
} catch (Throwable ex) { // Catch-all exception firewall
|
||||
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)
|
||||
msg = ex.toString();
|
||||
MessageNotifyUtil.Notify.error(module.getDisplayName() + " Error", msg);
|
||||
}
|
||||
if (this.job.isCancelled()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
if (!this.job.isCancelled()) {
|
||||
IngestManager.getInstance().fireFileIngestDone(file);
|
||||
AbstractFile file = task.getFile();
|
||||
for (PipelineModule module : this.modules) {
|
||||
try {
|
||||
FileIngestPipeline.ingestManager.setIngestTaskProgress(task, module.getDisplayName());
|
||||
module.process(file);
|
||||
} catch (Throwable ex) { // Catch-all exception firewall
|
||||
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) {
|
||||
msg = ex.toString();
|
||||
}
|
||||
MessageNotifyUtil.Notify.error(module.getDisplayName() + " Error", msg);
|
||||
}
|
||||
if (this.job.isCancelled()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
if (!this.job.isCancelled()) {
|
||||
IngestManager.getInstance().fireFileIngestDone(file);
|
||||
}
|
||||
}
|
||||
FileIngestPipeline.ingestManager.setIngestTaskProgressCompleted(task);
|
||||
return errors;
|
||||
@ -145,7 +148,7 @@ final class FileIngestPipeline {
|
||||
*/
|
||||
synchronized List<IngestModuleError> shutDown() {
|
||||
List<IngestModuleError> errors = new ArrayList<>();
|
||||
if(this.running == true){ // Don't shut down pipelines that never started
|
||||
if (this.running == true) { // Don't shut down pipelines that never started
|
||||
for (PipelineModule module : this.modules) {
|
||||
try {
|
||||
module.shutDown();
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user