mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Merge pull request #3581 from rcordovano/data-src-ingest-job-fix
Make DataSourceIngestJob's IngestJobInfo threadsafe
This commit is contained in:
commit
1d0de9c506
@ -165,7 +165,7 @@ final class DataSourceIngestJob {
|
||||
private String currentFileIngestModule = "";
|
||||
private String currentFileIngestTask = "";
|
||||
private final List<IngestModuleInfo> ingestModules = new ArrayList<>();
|
||||
private IngestJobInfo ingestJob;
|
||||
private volatile IngestJobInfo ingestJob;
|
||||
|
||||
/**
|
||||
* A data source ingest job uses this field to report its creation time.
|
||||
@ -414,6 +414,11 @@ final class DataSourceIngestJob {
|
||||
List<IngestModuleError> start() {
|
||||
List<IngestModuleError> errors = startUpIngestPipelines();
|
||||
if (errors.isEmpty()) {
|
||||
try {
|
||||
this.ingestJob = Case.getOpenCase().getSleuthkitCase().addIngestJob(dataSource, NetworkUtils.getLocalHostName(), ingestModules, new Date(this.createTime), new Date(0), IngestJobStatusType.STARTED, "");
|
||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
||||
logger.log(Level.SEVERE, "Failed to add ingest job to database.", ex);
|
||||
}
|
||||
if (this.hasFirstStageDataSourceIngestPipeline() || this.hasFileIngestPipeline()) {
|
||||
logger.log(Level.INFO, "Starting first stage analysis for {0} (jobId={1})", new Object[]{dataSource.getName(), this.id}); //NON-NLS
|
||||
this.startFirstStage();
|
||||
@ -421,11 +426,6 @@ final class DataSourceIngestJob {
|
||||
logger.log(Level.INFO, "Starting second stage analysis for {0} (jobId={1}), no first stage configured", new Object[]{dataSource.getName(), this.id}); //NON-NLS
|
||||
this.startSecondStage();
|
||||
}
|
||||
try {
|
||||
this.ingestJob = Case.getOpenCase().getSleuthkitCase().addIngestJob(dataSource, NetworkUtils.getLocalHostName(), ingestModules, new Date(this.createTime), new Date(0), IngestJobStatusType.STARTED, "");
|
||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
||||
logger.log(Level.SEVERE, "Failed to add ingest job to database.", ex);
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
@ -702,6 +702,7 @@ final class DataSourceIngestJob {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ingestJob != null) {
|
||||
if (this.cancelled) {
|
||||
try {
|
||||
ingestJob.setIngestJobStatus(IngestJobStatusType.CANCELLED);
|
||||
@ -720,8 +721,8 @@ final class DataSourceIngestJob {
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, "Failed to set end date for ingest job in database.", ex);
|
||||
}
|
||||
}
|
||||
this.parentJob.dataSourceJobFinished(this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user