mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
Merge pull request #5905 from APriestman/6324_removeLocking2
6324 Remove locking around adding image.
This commit is contained in:
commit
bb764aa5e1
@ -146,8 +146,7 @@ final class AddRawImageTask implements Runnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
imageFilePaths.add(imageFilePath);
|
imageFilePaths.add(imageFilePath);
|
||||||
try {
|
try {
|
||||||
caseDatabase.acquireSingleUserCaseWriteLock();
|
|
||||||
/*
|
/*
|
||||||
* Get Image that will be added to case
|
* Get Image that will be added to case
|
||||||
*/
|
*/
|
||||||
@ -187,9 +186,6 @@ final class AddRawImageTask implements Runnable {
|
|||||||
errorMessages.add(errorMessage);
|
errorMessages.add(errorMessage);
|
||||||
logger.log(Level.SEVERE, errorMessage, ex);
|
logger.log(Level.SEVERE, errorMessage, ex);
|
||||||
criticalErrorOccurred = true;
|
criticalErrorOccurred = true;
|
||||||
} finally {
|
|
||||||
caseDatabase.releaseSingleUserCaseWriteLock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,30 +116,25 @@ class AddMultipleImagesTask implements Runnable {
|
|||||||
* Try to add the input image files as images.
|
* Try to add the input image files as images.
|
||||||
*/
|
*/
|
||||||
List<String> corruptedImageFilePaths = new ArrayList<>();
|
List<String> corruptedImageFilePaths = new ArrayList<>();
|
||||||
try {
|
progressMonitor.setIndeterminate(true);
|
||||||
currentCase.getSleuthkitCase().acquireSingleUserCaseWriteLock();
|
for (String imageFilePath : imageFilePaths) {
|
||||||
progressMonitor.setIndeterminate(true);
|
synchronized (tskAddImageProcessLock) {
|
||||||
for (String imageFilePath : imageFilePaths) {
|
if (!tskAddImageProcessStopped) {
|
||||||
synchronized (tskAddImageProcessLock) {
|
addImageProcess = currentCase.getSleuthkitCase().makeAddImageProcess(timeZone, false, false, "");
|
||||||
if (!tskAddImageProcessStopped) {
|
} else {
|
||||||
addImageProcess = currentCase.getSleuthkitCase().makeAddImageProcess(timeZone, false, false, "");
|
return;
|
||||||
} else {
|
}
|
||||||
return;
|
}
|
||||||
}
|
run(imageFilePath, corruptedImageFilePaths, errorMessages);
|
||||||
}
|
commitOrRevertAddImageProcess(imageFilePath, errorMessages, newDataSources);
|
||||||
run(imageFilePath, corruptedImageFilePaths, errorMessages);
|
synchronized (tskAddImageProcessLock) {
|
||||||
commitOrRevertAddImageProcess(imageFilePath, errorMessages, newDataSources);
|
if (tskAddImageProcessStopped) {
|
||||||
synchronized (tskAddImageProcessLock) {
|
errorMessages.add(Bundle.AddMultipleImagesTask_cancelled());
|
||||||
if (tskAddImageProcessStopped) {
|
result = DataSourceProcessorResult.CRITICAL_ERRORS;
|
||||||
errorMessages.add(Bundle.AddMultipleImagesTask_cancelled());
|
newDataSources = emptyDataSources;
|
||||||
result = DataSourceProcessorResult.CRITICAL_ERRORS;
|
return;
|
||||||
newDataSources = emptyDataSources;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
currentCase.getSleuthkitCase().releaseSingleUserCaseWriteLock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -153,8 +148,6 @@ class AddMultipleImagesTask implements Runnable {
|
|||||||
try {
|
try {
|
||||||
progressMonitor.setProgressText(Bundle.AddMultipleImagesTask_addingFileAsLogicalFile(corruptedImageFilePaths.toString()));
|
progressMonitor.setProgressText(Bundle.AddMultipleImagesTask_addingFileAsLogicalFile(corruptedImageFilePaths.toString()));
|
||||||
|
|
||||||
caseDatabase.acquireSingleUserCaseWriteLock();
|
|
||||||
|
|
||||||
Image dataSource = caseDatabase.addImageInfo(0, corruptedImageFilePaths, timeZone);
|
Image dataSource = caseDatabase.addImageInfo(0, corruptedImageFilePaths, timeZone);
|
||||||
newDataSources.add(dataSource);
|
newDataSources.add(dataSource);
|
||||||
List<TskFileRange> fileRanges = new ArrayList<>();
|
List<TskFileRange> fileRanges = new ArrayList<>();
|
||||||
@ -177,8 +170,6 @@ class AddMultipleImagesTask implements Runnable {
|
|||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
errorMessages.add(Bundle.AddMultipleImagesTask_errorAddingImgWithoutFileSystem(deviceId, ex.getLocalizedMessage()));
|
errorMessages.add(Bundle.AddMultipleImagesTask_errorAddingImgWithoutFileSystem(deviceId, ex.getLocalizedMessage()));
|
||||||
criticalErrorOccurred = true;
|
criticalErrorOccurred = true;
|
||||||
} finally {
|
|
||||||
caseDatabase.releaseSingleUserCaseWriteLock();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,30 +146,25 @@ final class AddMemoryImageTask implements Runnable {
|
|||||||
progressMonitor.setProgressText(Bundle.AddMemoryImageTask_progressMessage_addingImageFile( memoryImagePath));
|
progressMonitor.setProgressText(Bundle.AddMemoryImageTask_progressMessage_addingImageFile( memoryImagePath));
|
||||||
|
|
||||||
SleuthkitCase caseDatabase = Case.getCurrentCaseThrows().getSleuthkitCase();
|
SleuthkitCase caseDatabase = Case.getCurrentCaseThrows().getSleuthkitCase();
|
||||||
caseDatabase.acquireSingleUserCaseWriteLock();
|
|
||||||
try {
|
|
||||||
/*
|
|
||||||
* Verify the memory image file exists.
|
|
||||||
*/
|
|
||||||
File imageFile = Paths.get(memoryImagePath).toFile();
|
|
||||||
if (!imageFile.exists()) {
|
|
||||||
throw new TskCoreException(Bundle.AddMemoryImageTask_exceptionMessage_noImageFile(memoryImagePath, deviceId));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add the data source.
|
* Verify the memory image file exists.
|
||||||
*
|
*/
|
||||||
* NOTE: The object id for device passed to
|
File imageFile = Paths.get(memoryImagePath).toFile();
|
||||||
* SleuthkitCase.addImageInfo is hard-coded to zero for now. This
|
if (!imageFile.exists()) {
|
||||||
* will need to be changed when a Device abstraction is added to the
|
throw new TskCoreException(Bundle.AddMemoryImageTask_exceptionMessage_noImageFile(memoryImagePath, deviceId));
|
||||||
* SleuthKit data model.
|
|
||||||
*/
|
|
||||||
Image dataSource = caseDatabase.addImageInfo(0, new ArrayList<>(Arrays.asList(memoryImagePath)), timeZone);
|
|
||||||
return dataSource;
|
|
||||||
|
|
||||||
} finally {
|
|
||||||
caseDatabase.releaseSingleUserCaseWriteLock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add the data source.
|
||||||
|
*
|
||||||
|
* NOTE: The object id for device passed to
|
||||||
|
* SleuthkitCase.addImageInfo is hard-coded to zero for now. This
|
||||||
|
* will need to be changed when a Device abstraction is added to the
|
||||||
|
* SleuthKit data model.
|
||||||
|
*/
|
||||||
|
Image dataSource = caseDatabase.addImageInfo(0, new ArrayList<>(Arrays.asList(memoryImagePath)), timeZone);
|
||||||
|
return dataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user