Merge develop into collab for SevenZipExtractor bug fix

This commit is contained in:
Richard Cordovano 2015-09-16 14:40:40 -04:00
commit 90fc49632b
2 changed files with 22 additions and 19 deletions

View File

@ -251,7 +251,7 @@ class SevenZipExtractor {
} }
if (detectedFormat == null) { 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 // if we don't have attribute info then use file extension
String extension = archiveFile.getNameExtension(); String extension = archiveFile.getNameExtension();
@ -901,7 +901,7 @@ class SevenZipExtractor {
UnpackedNode(String fileName, UnpackedNode parent) { UnpackedNode(String fileName, UnpackedNode parent) {
this.fileName = fileName; this.fileName = fileName;
this.parent = parent; 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 //new child derived file will be set by unpack() method
parent.children.add(this); parent.children.add(this);

View File

@ -19,13 +19,13 @@
package org.sleuthkit.autopsy.imagegallery; package org.sleuthkit.autopsy.imagegallery;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.Observable; import javafx.beans.Observable;
import javafx.beans.property.ReadOnlyBooleanProperty; import javafx.beans.property.ReadOnlyBooleanProperty;
@ -875,7 +875,7 @@ public final class ImageGalleryController {
* check for supported images * check for supported images
*/ */
// (name like '.jpg' or name like '.png' ...) // (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"); 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 @Override
public void run() { public void run() {
progressHandle.start(); progressHandle.start();
updateMessage("prepopulating image/video database"); 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<AbstractFile> files;
try { try {
List<Long> fsObjIds = new ArrayList<>(); String fsQuery = "";
String fsQuery;
if (dataSource instanceof Image) { if (dataSource instanceof Image) {
Image image = (Image) dataSource; List<FileSystem> fileSystems = ((Image) dataSource).getFileSystems();
for (FileSystem fs : image.getFileSystems()) { if (fileSystems.isEmpty() == false) {
fsObjIds.add(fs.getId()); /*
* 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 { } else {
/* /*
* NOTE: Logical files currently (Apr '15) have a null value * NOTE: Logical files currently (Apr '15) have a null value
@ -923,7 +926,7 @@ public final class ImageGalleryController {
fsQuery = "(fs_obj_id IS NULL) "; fsQuery = "(fs_obj_id IS NULL) ";
} }
files = getSleuthKitCase().findAllFilesWhere(fsQuery + " AND " + DRAWABLE_QUERY); final List<AbstractFile> files = getSleuthKitCase().findAllFilesWhere(fsQuery + " AND " + DRAWABLE_QUERY);
progressHandle.switchToDeterminate(files.size()); progressHandle.switchToDeterminate(files.size());
//do in transaction //do in transaction