return nothing if json cannot be parsed

This commit is contained in:
Greg DiCristofaro 2020-04-15 13:01:48 -04:00
parent da7fe3b905
commit 7640c0f549
4 changed files with 6 additions and 6 deletions

View File

@ -156,7 +156,6 @@ class AccountSummary {
countFromMessageAttachments(attachmentsAttr, artifact); countFromMessageAttachments(attachmentsAttr, artifact);
} catch (BlackboardJsonAttrUtil.InvalidJsonException ex) { } catch (BlackboardJsonAttrUtil.InvalidJsonException ex) {
logger.log(Level.WARNING, String.format("Unable to parse json for MessageAttachments object in artifact: %s", artifact.getName()), ex); logger.log(Level.WARNING, String.format("Unable to parse json for MessageAttachments object in artifact: %s", artifact.getName()), ex);
countFromArtifactChildren(artifact);
} }
} else { } else {
countFromArtifactChildren(artifact); countFromArtifactChildren(artifact);

View File

@ -134,7 +134,6 @@ final class AttachmentThumbnailsChildren extends Children.Keys<AbstractFile> {
addMessageAttachmentThumbnails(bba, attachmentsAttr, thumbnails); addMessageAttachmentThumbnails(bba, attachmentsAttr, thumbnails);
} catch (BlackboardJsonAttrUtil.InvalidJsonException ex) { } catch (BlackboardJsonAttrUtil.InvalidJsonException ex) {
LOGGER.log(Level.WARNING, String.format("Unable to parse json for MessageAttachments object in artifact: %s", bba.getName()), 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. } else { // backward compatibility - email message attachments are derived files, children of the message.
addChildrenThumbnails(bba, thumbnails); addChildrenThumbnails(bba, thumbnails);

View File

@ -159,10 +159,12 @@ class MessageNode extends BlackboardArtifactNode {
return msgAttachments.getAttachmentsCount(); return msgAttachments.getAttachmentsCount();
} catch (BlackboardJsonAttrUtil.InvalidJsonException ex) { } catch (BlackboardJsonAttrUtil.InvalidJsonException ex) {
logger.log(Level.WARNING, String.format("Unable to parse json for MessageAttachments object in artifact: %s", artifact.getName()), ex); logger.log(Level.WARNING, String.format("Unable to parse json for MessageAttachments object in artifact: %s", artifact.getName()), ex);
return 0;
} }
} }
else {
// legacy attachments may be children of message artifact. // legacy attachments may be children of message artifact.
return artifact.getChildrenCount(); return artifact.getChildrenCount();
} }
} }
}

View File

@ -692,7 +692,7 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
attachments = getAttachmentsFromMessageAttachments(attachmentsAttr); attachments = getAttachmentsFromMessageAttachments(attachmentsAttr);
} catch (BlackboardJsonAttrUtil.InvalidJsonException ex) { } catch (BlackboardJsonAttrUtil.InvalidJsonException ex) {
LOGGER.log(Level.WARNING, String.format("Unable to parse json for MessageAttachments object in artifact: %s", artifact.getName()), 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 { } else {
attachments = getAttachmentsFromChildren(artifact); attachments = getAttachmentsFromChildren(artifact);