From 7640c0f54911eab1b47ac5778c1e3492dca8a2c0 Mon Sep 17 00:00:00 2001 From: Greg DiCristofaro Date: Wed, 15 Apr 2020 13:01:48 -0400 Subject: [PATCH] return nothing if json cannot be parsed --- .../communications/relationships/AccountSummary.java | 1 - .../relationships/AttachmentThumbnailsChildren.java | 1 - .../autopsy/communications/relationships/MessageNode.java | 8 +++++--- .../autopsy/contentviewers/MessageContentViewer.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/communications/relationships/AccountSummary.java b/Core/src/org/sleuthkit/autopsy/communications/relationships/AccountSummary.java index d8f74fcc66..719fad80ec 100755 --- a/Core/src/org/sleuthkit/autopsy/communications/relationships/AccountSummary.java +++ b/Core/src/org/sleuthkit/autopsy/communications/relationships/AccountSummary.java @@ -156,7 +156,6 @@ class AccountSummary { countFromMessageAttachments(attachmentsAttr, artifact); } catch (BlackboardJsonAttrUtil.InvalidJsonException ex) { logger.log(Level.WARNING, String.format("Unable to parse json for MessageAttachments object in artifact: %s", artifact.getName()), ex); - countFromArtifactChildren(artifact); } } else { countFromArtifactChildren(artifact); diff --git a/Core/src/org/sleuthkit/autopsy/communications/relationships/AttachmentThumbnailsChildren.java b/Core/src/org/sleuthkit/autopsy/communications/relationships/AttachmentThumbnailsChildren.java index c703d34d84..64225e4fc2 100755 --- a/Core/src/org/sleuthkit/autopsy/communications/relationships/AttachmentThumbnailsChildren.java +++ b/Core/src/org/sleuthkit/autopsy/communications/relationships/AttachmentThumbnailsChildren.java @@ -134,7 +134,6 @@ final class AttachmentThumbnailsChildren extends Children.Keys { addMessageAttachmentThumbnails(bba, attachmentsAttr, thumbnails); } catch (BlackboardJsonAttrUtil.InvalidJsonException ex) { LOGGER.log(Level.WARNING, String.format("Unable to parse json for MessageAttachments object in artifact: %s", bba.getName()), ex); - addChildrenThumbnails(bba, thumbnails); } } else { // backward compatibility - email message attachments are derived files, children of the message. addChildrenThumbnails(bba, thumbnails); diff --git a/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageNode.java b/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageNode.java index 58c84406e0..6d5d5785f6 100755 --- a/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/relationships/MessageNode.java @@ -159,10 +159,12 @@ class MessageNode extends BlackboardArtifactNode { return msgAttachments.getAttachmentsCount(); } catch (BlackboardJsonAttrUtil.InvalidJsonException ex) { logger.log(Level.WARNING, String.format("Unable to parse json for MessageAttachments object in artifact: %s", artifact.getName()), ex); + return 0; } } - - // legacy attachments may be children of message artifact. - return artifact.getChildrenCount(); + else { + // legacy attachments may be children of message artifact. + return artifact.getChildrenCount(); + } } } diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java index 64ec0f60c0..032cb75e5f 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java @@ -692,7 +692,7 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont attachments = getAttachmentsFromMessageAttachments(attachmentsAttr); } catch (BlackboardJsonAttrUtil.InvalidJsonException ex) { LOGGER.log(Level.WARNING, String.format("Unable to parse json for MessageAttachments object in artifact: %s", artifact.getName()), ex); - attachments = getAttachmentsFromChildren(artifact); + attachments = new HashSet<>(); } } else { attachments = getAttachmentsFromChildren(artifact);