diff --git a/Core/src/org/sleuthkit/autopsy/timeline/ui/detailview/datamodel/EventCluster.java b/Core/src/org/sleuthkit/autopsy/timeline/ui/detailview/datamodel/EventCluster.java index c675ab86d8..0f710b7688 100755 --- a/Core/src/org/sleuthkit/autopsy/timeline/ui/detailview/datamodel/EventCluster.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/ui/detailview/datamodel/EventCluster.java @@ -18,10 +18,10 @@ */ package org.sleuthkit.autopsy.timeline.ui.detailview.datamodel; -import com.google.common.collect.Sets; import static java.util.Collections.emptySet; import static java.util.Collections.singleton; import java.util.Comparator; +import java.util.HashSet; import java.util.Objects; import java.util.Optional; import java.util.Set; @@ -99,9 +99,26 @@ public class EventCluster implements MultiEvent { Interval spanningInterval = IntervalUtils.span(cluster1.span, cluster2.span); - Set idsUnion = Sets.union(cluster1.getEventIDs(), cluster2.getEventIDs()); - Set hashHitsUnion = Sets.union(cluster1.getEventIDsWithHashHits(), cluster2.getEventIDsWithHashHits()); - Set taggedUnion = Sets.union(cluster1.getEventIDsWithTags(), cluster2.getEventIDsWithTags()); + Set idsUnion = cluster1.getEventIDs(); + if(!idsUnion.isEmpty()) { + idsUnion.addAll(cluster2.getEventIDs()); + } else { + idsUnion = cluster2.getEventIDs(); + } + + Set hashHitsUnion = cluster1.getEventIDsWithHashHits(); + if(!hashHitsUnion.isEmpty()) { + hashHitsUnion.addAll(cluster2.getEventIDsWithHashHits()); + } else { + hashHitsUnion = cluster2.getEventIDsWithHashHits(); + } + + Set taggedUnion = cluster1.getEventIDsWithTags(); + if(!taggedUnion.isEmpty()) { + taggedUnion.addAll(cluster2.getEventIDsWithTags()); + } else { + taggedUnion = cluster2.getEventIDsWithTags(); + } return new EventCluster(spanningInterval, cluster1.getEventType(), idsUnion, hashHitsUnion, taggedUnion, @@ -129,13 +146,16 @@ public class EventCluster implements MultiEvent { } public EventCluster(TimelineEvent event, EventType type, DescriptionLoD lod) { - this(new Interval(event.getStartMillis(), event.getEndMillis()), - type, - singleton(event.getEventID()), - event.isHashHit() ? singleton(event.getEventID()) : emptySet(), - event.isTagged() ? singleton(event.getEventID()) : emptySet(), - event.getDescription(lod), - lod); + this.span = new Interval(event.getStartMillis(), event.getEndMillis()); + this.type = type; + + this.eventIDs = new HashSet<>(); + this.eventIDs.add(event.getEventID()); + this.hashHits = event.isHashHit() ? new HashSet<>(eventIDs) : emptySet(); + this.tagged = event.isTagged() ? new HashSet<>(eventIDs) : emptySet(); + this.lod = lod; + this.description = event.getDescription(lod); + this.parent = null; }