From 371b00a9dcba1989450482a32f1d533ff8079b04 Mon Sep 17 00:00:00 2001 From: Raman Date: Thu, 29 Nov 2018 11:53:07 -0500 Subject: [PATCH 1/3] 1142: fix DrawableFile.getDataSource() --- .../autopsy/imagegallery/datamodel/DrawableFile.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java index 4b777b387d..438ace44d5 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java @@ -158,7 +158,11 @@ public abstract class DrawableFile { } public DataSource getDataSource() throws TskCoreException, TskDataException { - return getSleuthkitCase().getDataSource(file.getDataSource().getId()); + if (file.getDataSource() instanceof DataSource) { + return (DataSource)file.getDataSource(); + } else { + throw new TskCoreException(String.format("Failed to get data source for drawable file (id = %s)", file.getId())); + } } private Pair, Collection> makeAttributeValuePair(DrawableAttribute attribute) { From 1faf12f3e37e1c601660c9f8acd0b328dc21b7f2 Mon Sep 17 00:00:00 2001 From: Raman Date: Thu, 29 Nov 2018 12:40:53 -0500 Subject: [PATCH 2/3] Fixed error message. --- .../sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java index 438ace44d5..9a8c7dca59 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java @@ -161,7 +161,7 @@ public abstract class DrawableFile { if (file.getDataSource() instanceof DataSource) { return (DataSource)file.getDataSource(); } else { - throw new TskCoreException(String.format("Failed to get data source for drawable file (id = %s)", file.getId())); + throw new TskCoreException(String.format("File's data source is not of type DataSource (file id = %s)", file.getId())); } } From e84a1807d5d2f718184a0432409503310a0d053d Mon Sep 17 00:00:00 2001 From: Raman Date: Fri, 30 Nov 2018 13:36:44 -0500 Subject: [PATCH 3/3] 1142: eliminate extraneous DB round-trip in trying to get data source for a drawable file. --- .../autopsy/imagegallery/datamodel/DrawableFile.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java index 9a8c7dca59..9c84f6d3b2 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java @@ -158,11 +158,7 @@ public abstract class DrawableFile { } public DataSource getDataSource() throws TskCoreException, TskDataException { - if (file.getDataSource() instanceof DataSource) { - return (DataSource)file.getDataSource(); - } else { - throw new TskCoreException(String.format("File's data source is not of type DataSource (file id = %s)", file.getId())); - } + return getSleuthkitCase().getDataSource(file.getDataSourceObjectId()); } private Pair, Collection> makeAttributeValuePair(DrawableAttribute attribute) {