From ed07b15d4c76a1f428848bc87a167536f2321087 Mon Sep 17 00:00:00 2001 From: Greg DiCristofaro <gregd@basistech.com> Date: Thu, 12 May 2022 13:59:36 -0400 Subject: [PATCH] fixes --- .../modules/hashdatabase/HashDbCreateDatabaseDialog.java | 2 +- .../modules/hashdatabase/HashDbImportDatabaseDialog.java | 6 ++++-- .../modules/interestingitems/FileSetsDefinitions.java | 2 +- .../interestingitems/InterestingItemsFilesSetSettings.java | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java index dd51fc15ba..b132a8541e 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java @@ -432,7 +432,7 @@ private void saveAsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN- File hashDbFolder = new File(path.toString()); // create the folder if it doesn't exist if (!hashDbFolder.exists()) { - hashDbFolder.mkdir(); + hashDbFolder.mkdirs(); } if (!hashSetNameTextField.getText().isEmpty()) { path.append(File.separator).append(hashSetNameTextField.getText()); diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java index b6838f3adf..c9b4602dcf 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java @@ -430,7 +430,7 @@ private void openButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI File hashDbFolder = new File(lastBaseDirectory); // create the folder if it doesn't exist if (!hashDbFolder.exists()) { - hashDbFolder.mkdir(); + hashDbFolder.mkdirs(); } fileChooser.setCurrentDirectory(hashDbFolder); if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { @@ -534,7 +534,9 @@ private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS // copy the hash database to user configuration directory and use that path instead (JIRA-4177) String locationInUserConfigDir = Paths.get(HashLookupSettings.getBaseHashsetConfigPath(), HashDbCreateDatabaseDialog.HASH_DATABASE_DIR_NAME, hashSetNameTextField.getText(), file.getName()).toString(); try { - FileUtils.copyFile(file, new File(locationInUserConfigDir)); + File newFileLoc = new File(locationInUserConfigDir); + newFileLoc.getParentFile().mkdirs(); + FileUtils.copyFile(file, newFileLoc); // update the hash database location selectedFilePath = locationInUserConfigDir; } catch (IOException ex) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java index bca8a2d750..e2f353fee1 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java @@ -61,7 +61,7 @@ Map<String, FilesSet> getFilesSets() { */ static boolean writeDefinitionsFile(String basePath, String fileName, Map<String, FilesSet> interestingFilesSets) throws FilesSetsManager.FilesSetsManagerException { File outputPath = Paths.get(basePath, fileName).toFile(); - outputPath.mkdirs(); + outputPath.getParentFile().mkdirs(); try (final NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(outputPath))) { out.writeObject(new FileSetsDefinitions(interestingFilesSets)); } catch (IOException ex) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java index 376f1d5693..e165500132 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java @@ -608,7 +608,7 @@ static Map<String, FilesSet> readDefinitionsXML(Document doc, String resourceNam */ static boolean writeDefinitionsFile(String basePath, String fileName, Map<String, FilesSet> interestingFilesSets) throws FilesSetsManager.FilesSetsManagerException { File outputFile = Paths.get(basePath, fileName).toFile(); - outputFile.mkdirs(); + outputFile.getParentFile().mkdirs(); try (final NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(outputFile))) { out.writeObject(new InterestingItemsFilesSetSettings(interestingFilesSets)); } catch (IOException ex) { -- GitLab