diff --git a/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/SevenZipExtractor.java b/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/SevenZipExtractor.java index ffcdc5b34b..9aacb0619f 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/SevenZipExtractor.java +++ b/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/SevenZipExtractor.java @@ -251,7 +251,7 @@ class SevenZipExtractor { } if (detectedFormat == null) { - logger.log(Level.WARNING, "Could not detect format for file: " + archiveFile); //NON-NLS + logger.log(Level.WARNING, "Could not detect format for file: {0}", archiveFile); //NON-NLS // if we don't have attribute info then use file extension String extension = archiveFile.getNameExtension(); @@ -901,7 +901,7 @@ class SevenZipExtractor { UnpackedNode(String fileName, UnpackedNode parent) { this.fileName = fileName; this.parent = parent; - //this.localRelPath = parent.localRelPath + File.separator + fileName; + this.localRelPath = parent.localRelPath + File.separator + fileName; //new child derived file will be set by unpack() method parent.children.add(this); diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryController.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryController.java index 3fb29a58c1..395349cbce 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryController.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryController.java @@ -19,13 +19,13 @@ package org.sleuthkit.autopsy.imagegallery; import java.beans.PropertyChangeEvent; -import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.logging.Level; +import java.util.stream.Collectors; import javafx.application.Platform; import javafx.beans.Observable; import javafx.beans.property.ReadOnlyBooleanProperty; @@ -875,7 +875,7 @@ public final class ImageGalleryController { * check for supported images */ // (name like '.jpg' or name like '.png' ...) - private final String DRAWABLE_QUERY = "(name LIKE '%." + StringUtils.join(FileTypeUtils.getAllSupportedExtensions(), "' or name LIKE '%.") + "') "; + private final String DRAWABLE_QUERY = "(name LIKE '%." + StringUtils.join(FileTypeUtils.getAllSupportedExtensions(), "' OR name LIKE '%.") + "') "; private ProgressHandle progressHandle = ProgressHandleFactory.createHandle("prepopulating image/video database"); @@ -889,29 +889,32 @@ public final class ImageGalleryController { } /** - * Copy files from a newly added data source into the DB + * Copy files from a newly added data source into the DB. Get all + * "drawable" files, based on extension. After ingest we use file type + * id module and if necessary jpeg signature matching to add/remove + * files */ @Override public void run() { progressHandle.start(); updateMessage("prepopulating image/video database"); - /* - * Get all "drawable" files, based on extension. After ingest we use - * file type id module and if necessary jpeg signature matching to - * add/remove files - */ - final List files; try { - List fsObjIds = new ArrayList<>(); - - String fsQuery; + String fsQuery = ""; if (dataSource instanceof Image) { - Image image = (Image) dataSource; - for (FileSystem fs : image.getFileSystems()) { - fsObjIds.add(fs.getId()); + List fileSystems = ((Image) dataSource).getFileSystems(); + if (fileSystems.isEmpty() == false) { + /* + * no filesystems, don't bother with the initial + * population, just catch things on file_done + */ + progressHandle.finish(); + return; } - fsQuery = "(fs_obj_id = " + StringUtils.join(fsObjIds, " or fs_obj_id = ") + ") "; + String internal = fileSystems.stream() + .map(fileSystem -> String.valueOf(fileSystem.getId())) + .collect(Collectors.joining(" OR fs_obj_id = ")); + fsQuery = "(fs_obj_id = " + internal + ") "; //suffix } else { /* * NOTE: Logical files currently (Apr '15) have a null value @@ -923,7 +926,7 @@ public final class ImageGalleryController { fsQuery = "(fs_obj_id IS NULL) "; } - files = getSleuthKitCase().findAllFilesWhere(fsQuery + " AND " + DRAWABLE_QUERY); + final List files = getSleuthKitCase().findAllFilesWhere(fsQuery + " AND " + DRAWABLE_QUERY); progressHandle.switchToDeterminate(files.size()); //do in transaction