This commit is contained in:
Greg DiCristofaro 2021-09-08 14:19:52 -04:00
parent 5170c03bcb
commit 7adfcf4b17
2 changed files with 26 additions and 11 deletions

View File

@ -117,12 +117,13 @@ public class InterestingHits implements AutopsyVisitableItem {
Map<String, Set<Long>> setMapping = interestingItemsMap.getOrDefault(type, Collections.emptyMap());
setNames = new ArrayList<>(setMapping.keySet());
}
Collections.sort(setNames);
Collections.sort(setNames, (a, b) -> a.compareToIgnoreCase(b));
return setNames;
}
/**
* Returns all types currently in the map.
*
* @return The types present in the map.
*/
List<BlackboardArtifact.Type> getTypes() {
@ -130,7 +131,7 @@ public class InterestingHits implements AutopsyVisitableItem {
synchronized (interestingItemsMap) {
types = new ArrayList<>(interestingItemsMap.keySet());
}
Collections.sort(types, (a,b) -> a.getDisplayName().compareToIgnoreCase(b.getDisplayName()));
Collections.sort(types, (a, b) -> a.getDisplayName().compareToIgnoreCase(b.getDisplayName()));
return types;
}
@ -287,6 +288,17 @@ public class InterestingHits implements AutopsyVisitableItem {
return new SetNameNode(this.type, key);
}
@Override
protected void addNotify() {
interestingResults.update();
interestingResults.addObserver(this);
}
@Override
protected void finalize() throws Throwable {
interestingResults.deleteObserver(this);
}
@Override
public void update(Observable o, Object arg) {
refresh(true);
@ -318,7 +330,7 @@ public class InterestingHits implements AutopsyVisitableItem {
@Override
public boolean isLeafTypeNode() {
return false;
return true;
}
@Override

View File

@ -1409,7 +1409,7 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
private Node getInterestingItemNode(Children typesChildren, BlackboardArtifact art) {
Node interestingItemsRootNode = typesChildren.findChild(NbBundle
.getMessage(InterestingHits.class, "InterestingHits.interestingItems.text"));
Children interestingItemsRootChildren = interestingItemsRootNode.getChildren();
String setName = null;
try {
@ -1418,17 +1418,17 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
.map(attr -> attr.getValueString())
.findFirst()
.orElse(null);
} catch (TskCoreException ex) {
LOGGER.log(Level.WARNING, "Error retrieving attributes", ex); //NON-NLS
return null;
}
// if no set name, no set node will be identified.
if (setName == null) {
return null;
}
Stream<Node> typeNodes = interestingItemsRootChildren != null ? Stream.of(interestingItemsRootChildren.getNodes(true)) : Stream.empty();
Children setNodeChildren = typeNodes
@ -1444,10 +1444,13 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
if (setNodeChildren == null) {
return null;
}
// make sure data is fully loaded
setNodeChildren.getNodes(true);
return interestingItemsRootChildren.findChild(setName);
final String finalSetName = setName;
return Stream.of(setNodeChildren.getNodes(true))
.filter(setNode -> finalSetName.equals(setNode.getLookup().lookup(String.class)))
.findFirst()
.orElse(null);
}
/**