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 currentFileIngestModule = "";
|
||||||
private String currentFileIngestTask = "";
|
private String currentFileIngestTask = "";
|
||||||
private final List<IngestModuleInfo> ingestModules = new ArrayList<>();
|
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.
|
* 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> start() {
|
||||||
List<IngestModuleError> errors = startUpIngestPipelines();
|
List<IngestModuleError> errors = startUpIngestPipelines();
|
||||||
if (errors.isEmpty()) {
|
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()) {
|
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
|
logger.log(Level.INFO, "Starting first stage analysis for {0} (jobId={1})", new Object[]{dataSource.getName(), this.id}); //NON-NLS
|
||||||
this.startFirstStage();
|
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
|
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();
|
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;
|
return errors;
|
||||||
}
|
}
|
||||||
@ -702,6 +702,7 @@ final class DataSourceIngestJob {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ingestJob != null) {
|
||||||
if (this.cancelled) {
|
if (this.cancelled) {
|
||||||
try {
|
try {
|
||||||
ingestJob.setIngestJobStatus(IngestJobStatusType.CANCELLED);
|
ingestJob.setIngestJobStatus(IngestJobStatusType.CANCELLED);
|
||||||
@ -720,8 +721,8 @@ final class DataSourceIngestJob {
|
|||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.SEVERE, "Failed to set end date for ingest job in database.", ex);
|
logger.log(Level.SEVERE, "Failed to set end date for ingest job in database.", ex);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.parentJob.dataSourceJobFinished(this);
|
this.parentJob.dataSourceJobFinished(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user