mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
Merge branch 'develop' of https://github.com/sleuthkit/autopsy into disable_mu_linux
This commit is contained in:
commit
783226a8c9
@ -22,6 +22,7 @@ import java.awt.Dimension;
|
|||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.EOFException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -174,6 +175,9 @@ public class MediaViewImagePanel extends JPanel implements DataContentViewerMedi
|
|||||||
borderpane.setCenter(fxImageView);
|
borderpane.setCenter(fxImageView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (EOFException ex) {
|
||||||
|
LOGGER.log(Level.WARNING, "Could not load image file into media view (EOF): {0}", file.getName()); //NON-NLS
|
||||||
|
borderpane.setCenter(errorLabel);
|
||||||
} catch (IllegalArgumentException | IOException ex) {
|
} catch (IllegalArgumentException | IOException ex) {
|
||||||
LOGGER.log(Level.WARNING, "Could not load image file into media view: " + file.getName(), ex); //NON-NLS
|
LOGGER.log(Level.WARNING, "Could not load image file into media view: " + file.getName(), ex); //NON-NLS
|
||||||
borderpane.setCenter(errorLabel);
|
borderpane.setCenter(errorLabel);
|
||||||
|
@ -26,6 +26,7 @@ import com.google.common.io.Files;
|
|||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.EOFException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -135,8 +136,8 @@ public class ImageUtils {
|
|||||||
/**
|
/**
|
||||||
* thread that saves generated thumbnails to disk in the background
|
* thread that saves generated thumbnails to disk in the background
|
||||||
*/
|
*/
|
||||||
private static final Executor imageSaver
|
private static final Executor imageSaver =
|
||||||
= Executors.newSingleThreadExecutor(new BasicThreadFactory.Builder()
|
Executors.newSingleThreadExecutor(new BasicThreadFactory.Builder()
|
||||||
.namingPattern("icon saver-%d").build());
|
.namingPattern("icon saver-%d").build());
|
||||||
|
|
||||||
public static List<String> getSupportedImageExtensions() {
|
public static List<String> getSupportedImageExtensions() {
|
||||||
@ -524,14 +525,13 @@ public class ImageUtils {
|
|||||||
return ScalrWrapper.cropImage(bi, Math.min(iconSize, bi.getWidth()), Math.min(iconSize, bi.getHeight()));
|
return ScalrWrapper.cropImage(bi, Math.min(iconSize, bi.getWidth()), Math.min(iconSize, bi.getHeight()));
|
||||||
}
|
}
|
||||||
} catch (OutOfMemoryError e) {
|
} catch (OutOfMemoryError e) {
|
||||||
LOGGER.log(Level.WARNING, "Could not scale image (too large): " + content.getName(), e); //NON-NLS
|
LOGGER.log(Level.WARNING, "Could not scale image (too large) " + content.getName(), e); //NON-NLS
|
||||||
|
} catch (EOFException e) {
|
||||||
return null;
|
LOGGER.log(Level.WARNING, "Could not load image (EOF) {0}", content.getName()); //NON-NLS
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.log(Level.WARNING, "Could not load image: " + content.getName(), e); //NON-NLS
|
LOGGER.log(Level.WARNING, "Could not load image " + content.getName(), e); //NON-NLS
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,10 +49,12 @@ import javafx.scene.layout.CornerRadii;
|
|||||||
import javafx.scene.layout.Region;
|
import javafx.scene.layout.Region;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.netbeans.api.progress.ProgressHandle;
|
import org.netbeans.api.progress.ProgressHandle;
|
||||||
import org.netbeans.api.progress.ProgressHandleFactory;
|
import org.netbeans.api.progress.ProgressHandleFactory;
|
||||||
|
import org.openide.util.Cancellable;
|
||||||
import org.openide.util.Exceptions;
|
import org.openide.util.Exceptions;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
|
import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
|
||||||
@ -395,6 +397,9 @@ public final class ImageGalleryController {
|
|||||||
tagsManager.clearFollowUpTagName();
|
tagsManager.clearFollowUpTagName();
|
||||||
tagsManager.unregisterListener(groupManager);
|
tagsManager.unregisterListener(groupManager);
|
||||||
tagsManager.unregisterListener(categoryManager);
|
tagsManager.unregisterListener(categoryManager);
|
||||||
|
dbWorkerThread.cancelAllTasks();
|
||||||
|
dbWorkerThread = null;
|
||||||
|
restartWorker();
|
||||||
|
|
||||||
Toolbar.getDefault(this).reset();
|
Toolbar.getDefault(this).reset();
|
||||||
groupManager.clear();
|
groupManager.clear();
|
||||||
@ -418,7 +423,12 @@ public final class ImageGalleryController {
|
|||||||
dbWorkerThread.addTask(innerTask);
|
dbWorkerThread.addTask(innerTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
synchronized public DrawableFile<?> getFileFromId(Long fileID) throws TskCoreException {
|
synchronized public DrawableFile<?> getFileFromId(Long fileID) throws TskCoreException {
|
||||||
|
if (Objects.isNull(db)) {
|
||||||
|
LOGGER.log(Level.WARNING, "Could not get file from id, no DB set. The case is probably closed.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return db.getFileFromID(fileID);
|
return db.getFileFromID(fileID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,7 +597,7 @@ public final class ImageGalleryController {
|
|||||||
try {
|
try {
|
||||||
InnerTask it = workQueue.take();
|
InnerTask it = workQueue.take();
|
||||||
|
|
||||||
if (it.cancelled == false) {
|
if (it.isCancelled() == false) {
|
||||||
it.run();
|
it.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -609,7 +619,7 @@ public final class ImageGalleryController {
|
|||||||
/**
|
/**
|
||||||
* Abstract base class for task to be done on {@link DBWorkerThread}
|
* Abstract base class for task to be done on {@link DBWorkerThread}
|
||||||
*/
|
*/
|
||||||
static public abstract class InnerTask implements Runnable {
|
static public abstract class InnerTask implements Runnable, Cancellable {
|
||||||
|
|
||||||
public double getProgress() {
|
public double getProgress() {
|
||||||
return progress.get();
|
return progress.get();
|
||||||
@ -653,13 +663,13 @@ public final class ImageGalleryController {
|
|||||||
protected InnerTask() {
|
protected InnerTask() {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected volatile boolean cancelled = false;
|
@Override
|
||||||
|
synchronized public boolean cancel() {
|
||||||
public void cancel() {
|
|
||||||
updateState(Worker.State.CANCELLED);
|
updateState(Worker.State.CANCELLED);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isCancelled() {
|
synchronized protected boolean isCancelled() {
|
||||||
return getState() == Worker.State.CANCELLED;
|
return getState() == Worker.State.CANCELLED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -693,7 +703,7 @@ public final class ImageGalleryController {
|
|||||||
*/
|
*/
|
||||||
static private class UpdateFileTask extends FileTask {
|
static private class UpdateFileTask extends FileTask {
|
||||||
|
|
||||||
public UpdateFileTask(AbstractFile f, DrawableDB taskDB) {
|
UpdateFileTask(AbstractFile f, DrawableDB taskDB) {
|
||||||
super(f, taskDB);
|
super(f, taskDB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -720,7 +730,7 @@ public final class ImageGalleryController {
|
|||||||
*/
|
*/
|
||||||
static private class RemoveFileTask extends FileTask {
|
static private class RemoveFileTask extends FileTask {
|
||||||
|
|
||||||
public RemoveFileTask(AbstractFile f, DrawableDB taskDB) {
|
RemoveFileTask(AbstractFile f, DrawableDB taskDB) {
|
||||||
super(f, taskDB);
|
super(f, taskDB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -756,7 +766,7 @@ public final class ImageGalleryController {
|
|||||||
private final DrawableDB taskDB;
|
private final DrawableDB taskDB;
|
||||||
private final SleuthkitCase tskCase;
|
private final SleuthkitCase tskCase;
|
||||||
|
|
||||||
public CopyAnalyzedFiles(ImageGalleryController controller, DrawableDB taskDB, SleuthkitCase tskCase) {
|
CopyAnalyzedFiles(ImageGalleryController controller, DrawableDB taskDB, SleuthkitCase tskCase) {
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
this.taskDB = taskDB;
|
this.taskDB = taskDB;
|
||||||
this.tskCase = tskCase;
|
this.tskCase = tskCase;
|
||||||
@ -766,8 +776,8 @@ public final class ImageGalleryController {
|
|||||||
+ StringUtils.join(FileTypeUtils.getAllSupportedExtensions(),
|
+ StringUtils.join(FileTypeUtils.getAllSupportedExtensions(),
|
||||||
"' or name LIKE '%.")
|
"' or name LIKE '%.")
|
||||||
+ "')";
|
+ "')";
|
||||||
static private final String MIMETYPE_CLAUSE
|
static private final String MIMETYPE_CLAUSE =
|
||||||
= "blackboard_attributes.value_text LIKE '"
|
"blackboard_attributes.value_text LIKE '"
|
||||||
+ StringUtils.join(FileTypeUtils.getAllSupportedMimeTypes(),
|
+ StringUtils.join(FileTypeUtils.getAllSupportedMimeTypes(),
|
||||||
"' OR blackboard_attributes.value_text LIKE '") + "' ";
|
"' OR blackboard_attributes.value_text LIKE '") + "' ";
|
||||||
|
|
||||||
@ -801,7 +811,7 @@ public final class ImageGalleryController {
|
|||||||
DrawableDB.DrawableTransaction tr = taskDB.beginTransaction();
|
DrawableDB.DrawableTransaction tr = taskDB.beginTransaction();
|
||||||
int units = 0;
|
int units = 0;
|
||||||
for (final AbstractFile f : files) {
|
for (final AbstractFile f : files) {
|
||||||
if (cancelled) {
|
if (isCancelled()) {
|
||||||
LOGGER.log(Level.WARNING, "task cancelled: not all contents may be transfered to database");
|
LOGGER.log(Level.WARNING, "task cancelled: not all contents may be transfered to database");
|
||||||
progressHandle.finish();
|
progressHandle.finish();
|
||||||
break;
|
break;
|
||||||
@ -848,12 +858,12 @@ public final class ImageGalleryController {
|
|||||||
|
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
Logger.getLogger(CopyAnalyzedFiles.class.getName()).log(Level.WARNING, "failed to transfer all database contents", ex);
|
Logger.getLogger(CopyAnalyzedFiles.class.getName()).log(Level.WARNING, "failed to transfer all database contents", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
progressHandle.finish();
|
progressHandle.finish();
|
||||||
|
|
||||||
updateMessage("");
|
updateMessage("");
|
||||||
updateProgress(-1.0);
|
updateProgress(-1.0);
|
||||||
|
|
||||||
controller.setStale(false);
|
controller.setStale(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -877,13 +887,13 @@ public final class ImageGalleryController {
|
|||||||
// (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", this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param dataSourceId Data source object ID
|
* @param dataSourceId Data source object ID
|
||||||
*/
|
*/
|
||||||
public PrePopulateDataSourceFiles(Content dataSource) {
|
PrePopulateDataSourceFiles(Content dataSource) {
|
||||||
super();
|
super();
|
||||||
this.dataSource = dataSource;
|
this.dataSource = dataSource;
|
||||||
}
|
}
|
||||||
@ -933,7 +943,7 @@ public final class ImageGalleryController {
|
|||||||
DrawableDB.DrawableTransaction tr = db.beginTransaction();
|
DrawableDB.DrawableTransaction tr = db.beginTransaction();
|
||||||
int units = 0;
|
int units = 0;
|
||||||
for (final AbstractFile f : files) {
|
for (final AbstractFile f : files) {
|
||||||
if (cancelled) {
|
if (isCancelled()) {
|
||||||
LOGGER.log(Level.WARNING, "task cancelled: not all contents may be transfered to database");
|
LOGGER.log(Level.WARNING, "task cancelled: not all contents may be transfered to database");
|
||||||
progressHandle.finish();
|
progressHandle.finish();
|
||||||
break;
|
break;
|
||||||
@ -951,7 +961,7 @@ public final class ImageGalleryController {
|
|||||||
|
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
Logger.getLogger(PrePopulateDataSourceFiles.class.getName()).log(Level.WARNING, "failed to transfer all database contents", ex);
|
Logger.getLogger(PrePopulateDataSourceFiles.class.getName()).log(Level.WARNING, "failed to transfer all database contents", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
progressHandle.finish();
|
progressHandle.finish();
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ import org.openide.util.Lookup;
|
|||||||
*/
|
*/
|
||||||
@OptionsPanelController.TopLevelRegistration(
|
@OptionsPanelController.TopLevelRegistration(
|
||||||
categoryName = "#OptionsCategory_Name_Options",
|
categoryName = "#OptionsCategory_Name_Options",
|
||||||
iconBase = "org/sleuthkit/autopsy/imagegallery/images/polaroid_48_silhouette.png",
|
iconBase = "org/sleuthkit/autopsy/imagegallery/images/polaroid_32_silhouette.png",
|
||||||
keywords = "#OptionsCategory_Keywords_Options",
|
keywords = "#OptionsCategory_Keywords_Options",
|
||||||
keywordsCategory = "Options",
|
keywordsCategory = "Options",
|
||||||
position = 10
|
position = 10
|
||||||
|
@ -89,7 +89,7 @@ abstract public class DrawableUIBase extends AnchorPane implements DrawableView
|
|||||||
return fileOpt;
|
return fileOpt;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
fileOpt = Optional.of(getController().getFileFromId(fileIDOpt.get()));
|
fileOpt = Optional.ofNullable(getController().getFileFromId(fileIDOpt.get()));
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
Logger.getAnonymousLogger().log(Level.WARNING, "failed to get DrawableFile for obj_id" + fileIDOpt.get(), ex);
|
Logger.getAnonymousLogger().log(Level.WARNING, "failed to get DrawableFile for obj_id" + fileIDOpt.get(), ex);
|
||||||
fileOpt = Optional.empty();
|
fileOpt = Optional.empty();
|
||||||
@ -206,7 +206,6 @@ abstract public class DrawableUIBase extends AnchorPane implements DrawableView
|
|||||||
super.failed();
|
super.failed();
|
||||||
LOGGER.log(Level.SEVERE, "Failed to cache content for" + file.getName(), getException());
|
LOGGER.log(Level.SEVERE, "Failed to cache content for" + file.getName(), getException());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
abstract void saveToCache(X result);
|
abstract void saveToCache(X result);
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
Loading…
x
Reference in New Issue
Block a user