mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Merge pull request #380 from jawallace/data_source_name
Fixed npe while getting data source name for local files.
This commit is contained in:
commit
705c0e259d
@ -33,6 +33,7 @@ import org.sleuthkit.datamodel.BlackboardArtifact;
|
|||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
|
import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
|
||||||
import org.sleuthkit.datamodel.Content;
|
import org.sleuthkit.datamodel.Content;
|
||||||
|
import org.sleuthkit.datamodel.Image;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
import org.sleuthkit.datamodel.TskException;
|
import org.sleuthkit.datamodel.TskException;
|
||||||
|
|
||||||
@ -140,7 +141,12 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
|
|||||||
} else {
|
} else {
|
||||||
String dataSource = "";
|
String dataSource = "";
|
||||||
try {
|
try {
|
||||||
dataSource = associated.getImage().getName();
|
Image image = associated.getImage();
|
||||||
|
if (image != null) {
|
||||||
|
dataSource = image.getName();
|
||||||
|
} else {
|
||||||
|
dataSource = getRootParentName();
|
||||||
|
}
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.WARNING, "Failed to get image name from " + associated.getName());
|
logger.log(Level.WARNING, "Failed to get image name from " + associated.getName());
|
||||||
}
|
}
|
||||||
@ -153,6 +159,20 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
|
|||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getRootParentName() {
|
||||||
|
String parentName = associated.getName();
|
||||||
|
Content parent = associated;
|
||||||
|
try {
|
||||||
|
while ((parent = parent.getParent()) != null) {
|
||||||
|
parentName = parent.getName();
|
||||||
|
}
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
logger.log(Level.WARNING, "Failed to get parent name from " + associated.getName());
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return parentName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an additional custom node property to that node before it is
|
* Add an additional custom node property to that node before it is
|
||||||
|
Loading…
x
Reference in New Issue
Block a user