mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 07:56:16 +00:00
Fix case coord svc node deletion bug
This commit is contained in:
parent
7ec7eabf70
commit
bc36a5a31b
@ -762,12 +762,12 @@ public class Case {
|
|||||||
logger.log(Level.INFO, String.format("Used %d s to fail to acquire case directory coordination service lock for %s (%s) in %s", stopWatch.getElapsedTimeSecs(), metadata.getCaseDisplayName(), metadata.getCaseName(), metadata.getCaseDirectory()));
|
logger.log(Level.INFO, String.format("Used %d s to fail to acquire case directory coordination service lock for %s (%s) in %s", stopWatch.getElapsedTimeSecs(), metadata.getCaseDisplayName(), metadata.getCaseName(), metadata.getCaseDirectory()));
|
||||||
throw new CaseActionException(Bundle.Case_exceptionMessage_failedToDeleteCoordinationServiceNodes(), ex);
|
throw new CaseActionException(Bundle.Case_exceptionMessage_failedToDeleteCoordinationServiceNodes(), ex);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
deleteCoordinationServiceNodes(metadata, progressIndicator);
|
deleteCoordinationServiceNodes(metadata, progressIndicator);
|
||||||
} catch (CoordinationServiceException ex) {
|
} catch (CoordinationServiceException ex) {
|
||||||
throw new CaseActionException(Bundle.Case_creationException_couldNotAcquireDirLock(), ex);
|
throw new CaseActionException(Bundle.Case_creationException_couldNotAcquireDirLock(), ex);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
progressIndicator.finish();
|
progressIndicator.finish();
|
||||||
}
|
}
|
||||||
@ -1091,19 +1091,18 @@ public class Case {
|
|||||||
*
|
*
|
||||||
* @param caseDir The full path of the case directory.
|
* @param caseDir The full path of the case directory.
|
||||||
*
|
*
|
||||||
* @return The lock.
|
* @return The lock or null if the lock could not be acquired.
|
||||||
*
|
*
|
||||||
* @throws CaseActionException with a user-friendly message if the lock
|
* @throws CaseActionException with a user-friendly message if the lock
|
||||||
* cannot be acquired.
|
* cannot be acquired due to an exception.
|
||||||
*/
|
*/
|
||||||
@Messages({"Case.creationException.couldNotAcquireResourcesLock=Failed to get lock on case resources"})
|
@Messages({
|
||||||
|
"Case.creationException.couldNotAcquireResourcesLock=Failed to get lock on case resources"
|
||||||
|
})
|
||||||
private static CoordinationService.Lock acquireExclusiveCaseResourcesLock(String caseDir) throws CaseActionException {
|
private static CoordinationService.Lock acquireExclusiveCaseResourcesLock(String caseDir) throws CaseActionException {
|
||||||
try {
|
try {
|
||||||
String resourcesNodeName = caseDir + "_resources";
|
String resourcesNodeName = caseDir + "_resources";
|
||||||
Lock lock = CoordinationService.getInstance().tryGetExclusiveLock(CategoryNode.CASES, resourcesNodeName, RESOURCES_LOCK_TIMOUT_HOURS, TimeUnit.HOURS);
|
Lock lock = CoordinationService.getInstance().tryGetExclusiveLock(CategoryNode.CASES, resourcesNodeName, RESOURCES_LOCK_TIMOUT_HOURS, TimeUnit.HOURS);
|
||||||
if (null == lock) {
|
|
||||||
throw new CaseActionException(Bundle.Case_creationException_couldNotAcquireResourcesLock());
|
|
||||||
}
|
|
||||||
return lock;
|
return lock;
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
throw new CaseActionCancelledException(Bundle.Case_exceptionMessage_cancelledByUser());
|
throw new CaseActionCancelledException(Bundle.Case_exceptionMessage_cancelledByUser());
|
||||||
@ -1910,7 +1909,9 @@ public class Case {
|
|||||||
progressIndicator.progress(Bundle.Case_progressMessage_preparingToOpenCaseResources());
|
progressIndicator.progress(Bundle.Case_progressMessage_preparingToOpenCaseResources());
|
||||||
acquireSharedCaseDirLock(metadata.getCaseDirectory());
|
acquireSharedCaseDirLock(metadata.getCaseDirectory());
|
||||||
try (CoordinationService.Lock resourcesLock = acquireExclusiveCaseResourcesLock(metadata.getCaseDirectory())) {
|
try (CoordinationService.Lock resourcesLock = acquireExclusiveCaseResourcesLock(metadata.getCaseDirectory())) {
|
||||||
assert (resourcesLock != null); // Use reference to avoid compile time warning.
|
if (null == resourcesLock) {
|
||||||
|
throw new CaseActionException(Bundle.Case_creationException_couldNotAcquireResourcesLock());
|
||||||
|
}
|
||||||
open(isNewCase, progressIndicator);
|
open(isNewCase, progressIndicator);
|
||||||
} catch (CaseActionException ex) {
|
} catch (CaseActionException ex) {
|
||||||
releaseSharedCaseDirLock(getMetadata().getCaseDirectory());
|
releaseSharedCaseDirLock(getMetadata().getCaseDirectory());
|
||||||
@ -2492,7 +2493,9 @@ public class Case {
|
|||||||
*/
|
*/
|
||||||
progressIndicator.progress(Bundle.Case_progressMessage_preparing());
|
progressIndicator.progress(Bundle.Case_progressMessage_preparing());
|
||||||
try (CoordinationService.Lock resourcesLock = acquireExclusiveCaseResourcesLock(metadata.getCaseDirectory())) {
|
try (CoordinationService.Lock resourcesLock = acquireExclusiveCaseResourcesLock(metadata.getCaseDirectory())) {
|
||||||
assert (null != resourcesLock);
|
if (null == resourcesLock) {
|
||||||
|
throw new CaseActionException(Bundle.Case_creationException_couldNotAcquireResourcesLock());
|
||||||
|
}
|
||||||
close(progressIndicator);
|
close(progressIndicator);
|
||||||
} finally {
|
} finally {
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user