defensive code

This commit is contained in:
Greg DiCristofaro 2020-05-14 09:55:23 -04:00
parent 42a077b3ac
commit 2d3dcc43e8

View File

@ -374,7 +374,7 @@ final class CaseEventListener implements PropertyChangeListener {
private void handleTagAdded(BlackBoardArtifactTagAddedEvent evt) { private void handleTagAdded(BlackBoardArtifactTagAddedEvent evt) {
// ensure tag added event has a valid content id // ensure tag added event has a valid content id
if (evt.getAddedTag() == null || evt.getAddedTag().getContent() == null) { if (evt.getAddedTag() == null || evt.getAddedTag().getContent() == null || evt.getAddedTag().getArtifact() == null) {
LOGGER.log(Level.SEVERE, LOGGER.log(Level.SEVERE,
String.format("ContentTagAddedEvent %s did not have valid content to provide a content id.", evt)); String.format("ContentTagAddedEvent %s did not have valid content to provide a content id.", evt));
return; return;
@ -440,7 +440,6 @@ final class CaseEventListener implements PropertyChangeListener {
private void setArtifactKnownStatus(BlackboardArtifact bbArtifact, TskData.FileKnown knownStatus) { private void setArtifactKnownStatus(BlackboardArtifact bbArtifact, TskData.FileKnown knownStatus) {
List<CorrelationAttributeInstance> convertedArtifacts = CorrelationAttributeUtil.makeCorrAttrsForCorrelation(bbArtifact); List<CorrelationAttributeInstance> convertedArtifacts = CorrelationAttributeUtil.makeCorrAttrsForCorrelation(bbArtifact);
for (CorrelationAttributeInstance eamArtifact : convertedArtifacts) { for (CorrelationAttributeInstance eamArtifact : convertedArtifacts) {
eamArtifact.setComment("");
try { try {
dbManager.setAttributeInstanceKnownStatus(eamArtifact, knownStatus); dbManager.setAttributeInstanceKnownStatus(eamArtifact, knownStatus);
} catch (CentralRepoException ex) { } catch (CentralRepoException ex) {