mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 07:56:16 +00:00
Fixed case deletion for 7ZipExtractor, NPE from Services, and NoClassDefFound for FileUtils
This commit is contained in:
parent
b9206ac52d
commit
249c69be84
@ -54,6 +54,7 @@ public class Services implements Closeable {
|
|||||||
tagsManager = new TagsManager(caseDb);
|
tagsManager = new TagsManager(caseDb);
|
||||||
services.add(tagsManager);
|
services.add(tagsManager);
|
||||||
|
|
||||||
|
//This may be null for feature tests!
|
||||||
keywordSearchService = Lookup.getDefault().lookup(KeywordSearchService.class);
|
keywordSearchService = Lookup.getDefault().lookup(KeywordSearchService.class);
|
||||||
services.add(keywordSearchService);
|
services.add(keywordSearchService);
|
||||||
|
|
||||||
@ -105,8 +106,10 @@ public class Services implements Closeable {
|
|||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
for (Closeable service : services) {
|
for (Closeable service : services) {
|
||||||
|
if(service != null) {
|
||||||
service.close();
|
service.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -706,6 +706,7 @@ class SevenZipExtractor {
|
|||||||
parentAr.addChild(child);
|
parentAr.addChild(child);
|
||||||
depthMap.put(unpackedFile.getId(), child);
|
depthMap.put(unpackedFile.getId(), child);
|
||||||
}
|
}
|
||||||
|
unpackedFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (TskCoreException | NoCurrentCaseException e) {
|
} catch (TskCoreException | NoCurrentCaseException e) {
|
||||||
|
@ -29,6 +29,7 @@ import org.sleuthkit.autopsy.casemodule.Case;
|
|||||||
import org.sleuthkit.autopsy.casemodule.CaseActionException;
|
import org.sleuthkit.autopsy.casemodule.CaseActionException;
|
||||||
import org.sleuthkit.autopsy.casemodule.CaseDetails;
|
import org.sleuthkit.autopsy.casemodule.CaseDetails;
|
||||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.FileUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class with utility methods for opening and closing cases for functional
|
* Class with utility methods for opening and closing cases for functional
|
||||||
@ -53,11 +54,8 @@ public final class CaseUtils {
|
|||||||
Path caseDirectoryPath = Paths.get(System.getProperty("java.io.tmpdir"), caseName);
|
Path caseDirectoryPath = Paths.get(System.getProperty("java.io.tmpdir"), caseName);
|
||||||
File caseDirectory = caseDirectoryPath.toFile();
|
File caseDirectory = caseDirectoryPath.toFile();
|
||||||
if (caseDirectory.exists()) {
|
if (caseDirectory.exists()) {
|
||||||
try {
|
if(!FileUtil.deleteDir(caseDirectory)){
|
||||||
FileUtils.deleteDirectory(caseDirectory);
|
Assert.fail(String.format("Failed to delete existing case %s at %s", caseName, caseDirectoryPath));
|
||||||
} catch (IOException ex) {
|
|
||||||
Assert.fail(String.format("Failed to delete existing case %s at %s: %s", caseName, caseDirectoryPath, ex.getMessage()));
|
|
||||||
Exceptions.printStackTrace(ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,14 +95,9 @@ public final class CaseUtils {
|
|||||||
try {
|
try {
|
||||||
Case.closeCurrentCase();
|
Case.closeCurrentCase();
|
||||||
if (deleteCase) {
|
if (deleteCase) {
|
||||||
/*
|
if(!FileUtil.deleteDir(new File(caseDirectory))){
|
||||||
* TODO (JIRA-4241): Restore the code to delete the case
|
Assert.fail(String.format("Failed to delete case directory for case %s at %s", caseName, caseDirectory));
|
||||||
* directory when the Image Gallery tool cleans up its drawable
|
}
|
||||||
* database connection deterministically, instead of in a
|
|
||||||
* finalizer. As it is now, case deletion can fail due to an
|
|
||||||
* open drawable database file handles.
|
|
||||||
*/
|
|
||||||
//FileUtils.deleteDirectory(caseDirectory);
|
|
||||||
}
|
}
|
||||||
} catch (CaseActionException ex) {
|
} catch (CaseActionException ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user