From 83082ea940ff76c49502e616f722e6fb008d934c Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Fri, 26 Jul 2019 15:17:38 -0400 Subject: [PATCH] cleaned up warnings in timeline --- .../org/sleuthkit/autopsy/casemodule/Case.java | 1 + .../autopsy/casemodule/services/Services.java | 15 +++++++++++++++ .../DataSourceIntegrityIngestModule.java | 9 ++++++--- .../autopsy/test/CustomArtifactType.java | 4 ++-- ...tomArtifactsCreatorDataSourceIngestModule.java | 2 +- .../CustomArtifactsCreatorFileIngestModule.java | 2 +- .../InterestingArtifactCreatorIngestModule.java | 8 ++++---- .../ui/listvew/datamodel/ListViewModel.java | 2 +- 8 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/Case.java b/Core/src/org/sleuthkit/autopsy/casemodule/Case.java index 370e978804..640f4f8825 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/Case.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/Case.java @@ -415,6 +415,7 @@ public class Case { eventPublisher.publish(new TimelineEventAddedEvent(event)); } + @SuppressWarnings("deprecation") @Subscribe public void rebroadcastArtifactsPosted(Blackboard.ArtifactsPostedEvent event) { for (BlackboardArtifact.Type artifactType : event.getArtifactTypes()) { diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java index 1e8d8fcb2e..a71b700f2c 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.openide.util.Lookup; +import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchService; import org.sleuthkit.datamodel.SleuthkitCase; @@ -39,6 +40,7 @@ public class Services implements Closeable { private final FileManager fileManager; private final TagsManager tagsManager; private final KeywordSearchService keywordSearchService; + @SuppressWarnings("deprecation") private final Blackboard blackboard; /** @@ -47,6 +49,7 @@ public class Services implements Closeable { * * @param caseDb The case database for the current case. */ + @SuppressWarnings("deprecation") public Services(SleuthkitCase caseDb) { fileManager = new FileManager(caseDb); services.add(fileManager); @@ -95,10 +98,22 @@ public class Services implements Closeable { * Gets the blackboard service for the current case. * * @return The blackboard service for the current case. + * + * @deprecated Use org.sleuthkit.autopsy.casemodule.getCaseBlackboard instead */ + @Deprecated public Blackboard getBlackboard() { return blackboard; } + + /** + * Gets the TSK Blackboard for the current case. + * + * @return @org.sleuthkit.datamodel.Blackboard Blackboard for the current case. + */ + public org.sleuthkit.datamodel.Blackboard getCaseBlackboard() { + return Case.getCurrentCase().getSleuthkitCase().getBlackboard(); + } /** * Closes the services for the current case. diff --git a/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestModule.java index 34a7ec2702..250aab712d 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/dataSourceIntegrity/DataSourceIntegrityIngestModule.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.logging.Level; import javax.xml.bind.DatatypeConverter; import java.util.Arrays; +import org.openide.util.Exceptions; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.DataSourceIngestModule; import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress; @@ -38,6 +39,7 @@ import org.sleuthkit.datamodel.Image; import org.sleuthkit.datamodel.TskCoreException; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.datamodel.Blackboard; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.TskDataException; @@ -297,11 +299,12 @@ public class DataSourceIntegrityIngestModule implements DataSourceIngestModule { BlackboardArtifact verificationFailedArtifact = Case.getCurrentCase().getSleuthkitCase().newBlackboardArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_VERIFICATION_FAILED, img.getId()); verificationFailedArtifact.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT, DataSourceIntegrityModuleFactory.getModuleName(), artifactComment)); - IngestServices.getInstance().fireModuleDataEvent(new ModuleDataEvent(DataSourceIntegrityModuleFactory.getModuleName(), - BlackboardArtifact.ARTIFACT_TYPE.TSK_VERIFICATION_FAILED)); + Case.getCurrentCase().getServices().getCaseBlackboard().postArtifact(verificationFailedArtifact, DataSourceIntegrityModuleFactory.getModuleName()); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Error creating verification failed artifact", ex); - } + } catch (Blackboard.BlackboardException ex) { + Exceptions.printStackTrace(ex); + } } services.postMessage(IngestMessage.createMessage(messageType, DataSourceIntegrityModuleFactory.getModuleName(), diff --git a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java index 032f7da506..35dc103e5c 100644 --- a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java +++ b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java @@ -23,7 +23,7 @@ import java.util.List; import javax.xml.bind.DatatypeConverter; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.casemodule.services.Blackboard; +import org.sleuthkit.datamodel.Blackboard; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.Content; @@ -65,7 +65,7 @@ final class CustomArtifactType { * @throws BlackboardException If there is an error adding any of the types. */ static void addToCaseDatabase() throws Blackboard.BlackboardException, NoCurrentCaseException { - Blackboard blackboard = Case.getCurrentCaseThrows().getServices().getBlackboard(); + Blackboard blackboard = Case.getCurrentCaseThrows().getServices().getCaseBlackboard(); artifactType = blackboard.getOrAddArtifactType(ARTIFACT_TYPE_NAME, ARTIFACT_DISPLAY_NAME); intAttrType = blackboard.getOrAddAttributeType(INT_ATTR_TYPE_NAME, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.INTEGER, INT_ATTR_DISPLAY_NAME); doubleAttrType = blackboard.getOrAddAttributeType(DOUBLE_ATTR_TYPE_NAME, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DOUBLE, DOUBLE_ATTR_DISPLAY_NAME); diff --git a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorDataSourceIngestModule.java b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorDataSourceIngestModule.java index 8293ba934e..d9a321e216 100644 --- a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorDataSourceIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorDataSourceIngestModule.java @@ -21,11 +21,11 @@ package org.sleuthkit.autopsy.test; import java.util.logging.Level; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.casemodule.services.Blackboard; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleAdapter; import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress; import org.sleuthkit.autopsy.ingest.IngestJobContext; +import org.sleuthkit.datamodel.Blackboard; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; diff --git a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorFileIngestModule.java index abd6f0d00d..1e263dc50a 100644 --- a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactsCreatorFileIngestModule.java @@ -21,10 +21,10 @@ package org.sleuthkit.autopsy.test; import java.util.logging.Level; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.casemodule.services.Blackboard; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.FileIngestModuleAdapter; import org.sleuthkit.autopsy.ingest.IngestJobContext; +import org.sleuthkit.datamodel.Blackboard; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskCoreException; diff --git a/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java b/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java index f3232ceb86..7df13edfad 100644 --- a/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java @@ -26,17 +26,17 @@ import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.casemodule.services.Blackboard; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.FileIngestModuleAdapter; import org.sleuthkit.autopsy.ingest.IngestJobContext; import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.Blackboard; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.TskCoreException; /** - * A file ingest module that creates some interestng artifacts + * A file ingest module that creates some interesting artifacts * with attributes based on files for test purposes. */ @NbBundle.Messages({ @@ -55,7 +55,7 @@ final class InterestingArtifactCreatorIngestModule extends FileIngestModuleAdapt @Override public void startUp(IngestJobContext context) throws IngestModuleException { try { - Blackboard blackboard = Case.getCurrentCaseThrows().getServices().getBlackboard(); + Blackboard blackboard = Case.getCurrentCaseThrows().getServices().getCaseBlackboard(); artifactType = blackboard.getOrAddArtifactType(INT_ARTIFACT_TYPE_NAME, INT_ARTIFACT_DISPLAY_NAME); } catch (Blackboard.BlackboardException | NoCurrentCaseException ex) { throw new IngestModuleException(Bundle.InterestingArtifactCreatorIngestModule_exceptionMessage_errorCreatingCustomType(), ex); @@ -77,7 +77,7 @@ final class InterestingArtifactCreatorIngestModule extends FileIngestModuleAdapt * type. */ int randomArtIndex = (int) (Math.random() * 3); - Blackboard blackboard = Case.getCurrentCaseThrows().getServices().getBlackboard(); + Blackboard blackboard = Case.getCurrentCaseThrows().getServices().getCaseBlackboard(); BlackboardArtifact.Type artifactTypeBase = blackboard.getOrAddArtifactType(ARTIFACT_TYPE_NAMES[randomArtIndex], ARTIFACT_DISPLAY_NAMES[randomArtIndex]); BlackboardArtifact artifactBase = file.newArtifact(artifactTypeBase.getTypeID()); Collection baseAttributes = new ArrayList<>(); diff --git a/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/datamodel/ListViewModel.java b/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/datamodel/ListViewModel.java index 3c70654f12..4103e736fe 100755 --- a/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/datamodel/ListViewModel.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/ui/listvew/datamodel/ListViewModel.java @@ -83,7 +83,7 @@ public class ListViewModel { List events = eventManager.getEvents(timeRange, filterState.getActiveFilter()); if (events == null || events.isEmpty()) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } ArrayList combinedEvents = new ArrayList<>();