1
0
mirror of https://github.com/elisspace/autopsy.git synced 2026-09-04 06:50:00 +00:00

Merge pull request #2390 from millmanorama/2053-accounts-refresh

fix null pointer exception, and index out of bounds exception when re…
This commit is contained in:
Richard Cordovano
2016-11-01 19:17:29 -04:00
committed by GitHub

View File

@@ -1044,8 +1044,8 @@ final public class Accounts implements AutopsyVisitableItem {
private BINNode(BinResult bin) {
super(Children.LEAF);
setChildren(Children.createLazy(CreditCardNumberFactory::new));
this.bin = bin;
setChildren(Children.createLazy(CreditCardNumberFactory::new));
setName(getBinRangeString());
updateDisplayName();
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/bank.png"); //NON-NLS
@@ -1364,18 +1364,27 @@ final public class Accounts implements AutopsyVisitableItem {
*/
if (newStatus == BlackboardArtifact.ReviewStatus.REJECTED && showRejected == false) {
List<Node> siblings = Arrays.asList(node.getParentNode().getChildren().getNodes());
int indexOf = siblings.indexOf(node);
//there is no previous for the first node, so instead we select the next one
Node sibling = indexOf > 0
? siblings.get(indexOf - 1)
: siblings.get(indexOf + 1);
createPath = NodeOp.createPath(sibling, null);
if (siblings.size() > 1) {
int indexOf = siblings.indexOf(node);
//there is no previous for the first node, so instead we select the next one
Node sibling = indexOf > 0
? siblings.get(indexOf - 1)
: siblings.get(Integer.max(indexOf + 1, siblings.size() - 1));
createPath = NodeOp.createPath(sibling, null);
} else {
/* if there are no other siblings to select,
* just return null, but note we need to filter
* this out of stream below */
return null;
}
} else {
createPath = NodeOp.createPath(node, null);
}
//for the reselect to work we need to strip off the first part of the path.
return Arrays.copyOfRange(createPath, 1, createPath.length);
}).collect(Collectors.toList());
})
.filter(Objects::nonNull)
.collect(Collectors.toList());
//change status of selected artifacts
final Collection<? extends BlackboardArtifact> artifacts = Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class);