From cf71eaa46685f73e8aca4ac95eb2e2bfc71fcf2a Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Wed, 2 Oct 2019 14:29:32 -0400 Subject: [PATCH] Do not make inappropriate DisplayableItemNode.findLinked public API --- .../datamodel/DisplayableItemNode.java | 2 +- .../timeline/explorernodes/EventNode.java | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNode.java index 1673fd577f..c723d99b55 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/DisplayableItemNode.java @@ -51,7 +51,7 @@ public abstract class DisplayableItemNode extends AbstractNode { * * @throws TskCoreException */ - protected static AbstractFile findLinked(BlackboardArtifact artifact) throws TskCoreException { + static AbstractFile findLinked(BlackboardArtifact artifact) throws TskCoreException { BlackboardAttribute pathIDAttribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID)); if (pathIDAttribute != null) { long contentID = pathIDAttribute.getValueLong(); diff --git a/Core/src/org/sleuthkit/autopsy/timeline/explorernodes/EventNode.java b/Core/src/org/sleuthkit/autopsy/timeline/explorernodes/EventNode.java index ad7a61b52f..be05c59b67 100755 --- a/Core/src/org/sleuthkit/autopsy/timeline/explorernodes/EventNode.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/explorernodes/EventNode.java @@ -51,6 +51,7 @@ import org.sleuthkit.autopsy.timeline.actions.ViewFileInTimelineAction; import org.sleuthkit.autopsy.timeline.ui.EventTypeUtils; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; @@ -175,6 +176,26 @@ public class EventNode extends DisplayableItemNode { return actionsList.toArray(new Action[actionsList.size()]); } + /** + * Gets the file, if any, linked to an artifact via a TSK_PATH_ID attribute + * + * @param artifact The artifact. + * + * @return An AbstractFile or null. + * + * @throws TskCoreException + */ + private static AbstractFile findLinked(BlackboardArtifact artifact) throws TskCoreException { + BlackboardAttribute pathIDAttribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID)); + if (pathIDAttribute != null) { + long contentID = pathIDAttribute.getValueLong(); + if (contentID != -1) { + return artifact.getSleuthkitCase().getAbstractFileById(contentID); + } + } + return null; + } + @Override public boolean isLeafTypeNode() { return true;