From e94dc86797b0b9b2f6e2c8d3bcd30940f3158c23 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 11 Jul 2019 12:42:25 -0400 Subject: [PATCH 1/8] Fix check for SCO columns to occur before any work done --- .../autopsy/datamodel/Bundle.properties-MERGED | 1 + .../org/sleuthkit/autopsy/datamodel/GetSCOTask.java | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/datamodel/Bundle.properties-MERGED index 57cdd1bf48..7f0a4d2419 100755 --- a/Core/src/org/sleuthkit/autopsy/datamodel/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/datamodel/Bundle.properties-MERGED @@ -160,6 +160,7 @@ KeywordHits.createSheet.numChildren.name=Number of Children KeywordHits.kwHits.text=Keyword Hits KeywordHits.simpleLiteralSearch.text=Single Literal Keyword Search KeywordHits.singleRegexSearch.text=Single Regular Expression Search +LayoutFileNode.getActions.viewFileInDir.text=View File in Directory OpenIDE-Module-Name=DataModel AbstractContentChildren.CreateTSKNodeVisitor.exception.noNodeMsg=No Node defined for the given SleuthkitItem AbstractContentChildren.createAutopsyNodeVisitor.exception.noNodeMsg=No Node defined for the given DisplayableItem diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/GetSCOTask.java b/Core/src/org/sleuthkit/autopsy/datamodel/GetSCOTask.java index c96dd582d5..3f31664f43 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/GetSCOTask.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/GetSCOTask.java @@ -59,20 +59,21 @@ class GetSCOTask implements Runnable { public void run() { AbstractContentNode contentNode = weakNodeRef.get(); - //Check for stale reference - if (contentNode == null) { + //Check for stale reference or if columns are disabled + if (contentNode == null || UserPreferences.getHideSCOColumns()) { return; } - // get the SCO column values List tags = contentNode.getAllTagsFromDatabase(); - CorrelationAttributeInstance fileAttribute = contentNode.getCorrelationAttributeInstance(); SCOData scoData = new SCOData(); scoData.setScoreAndDescription(contentNode.getScorePropertyAndDescription(tags)); + //getting the correlation attribute and setting the comment column is done before the eamdb isEnabled check + //because the Comment column will reflect the presence of columns in the CR when the CR is enabled but still reflect tag comments when not + CorrelationAttributeInstance fileAttribute = contentNode.getCorrelationAttributeInstance(); scoData.setComment(contentNode.getCommentProperty(tags, fileAttribute)); - if (EamDb.isEnabled() && !UserPreferences.getHideSCOColumns()) { + if (EamDb.isEnabled()) { Type type = null; String value = null; String description = Bundle.GetSCOTask_occurrences_defaultDescription(); From 93aa0fc577f5ae5ce876a10ffbbde2eff8ff755e Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 11 Jul 2019 12:46:55 -0400 Subject: [PATCH 2/8] Fix typo in comment --- Core/src/org/sleuthkit/autopsy/datamodel/GetSCOTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/GetSCOTask.java b/Core/src/org/sleuthkit/autopsy/datamodel/GetSCOTask.java index 3f31664f43..6202f6f444 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/GetSCOTask.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/GetSCOTask.java @@ -69,7 +69,7 @@ class GetSCOTask implements Runnable { SCOData scoData = new SCOData(); scoData.setScoreAndDescription(contentNode.getScorePropertyAndDescription(tags)); //getting the correlation attribute and setting the comment column is done before the eamdb isEnabled check - //because the Comment column will reflect the presence of columns in the CR when the CR is enabled but still reflect tag comments when not + //because the Comment column will reflect the presence of comments in the CR when the CR is enabled, but reflect tag comments regardless CorrelationAttributeInstance fileAttribute = contentNode.getCorrelationAttributeInstance(); scoData.setComment(contentNode.getCommentProperty(tags, fileAttribute)); From deb23dd6a761bff7efdbb6864b8b031bd7b09949 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Thu, 8 Aug 2019 10:02:36 -0400 Subject: [PATCH 3/8] Complete deprecation of Autopsy Blackboard --- .../src/org/sleuthkit/autopsy/casemodule/services/Services.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java index e5edd14ebd..c531c62b38 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java @@ -103,7 +103,7 @@ public class Services implements Closeable { * * @return The blackboard service for the current case. * - * @deprecated Use org.sleuthkit.autopsy.casemodule.getCaseBlackboard + * @deprecated Use org.sleuthkit.autopsy.casemodule.getArtifactsBlackboard * instead */ @Deprecated From 5b80cae771bd6915e869c916fbf0619f072af425 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Mon, 12 Aug 2019 16:39:03 -0400 Subject: [PATCH 4/8] Implement backwards compatible fix for closeable case services --- .../casemodule/Bundle.properties-MERGED | 1 - .../sleuthkit/autopsy/casemodule/Case.java | 19 +----- .../casemodule/services/Blackboard.java | 21 +++++- .../casemodule/services/FileManager.java | 68 +++++++++++-------- .../autopsy/casemodule/services/Services.java | 22 +++--- .../KeywordSearchService.java | 44 ++++++++---- .../keywordsearch/SolrSearchService.java | 12 ++-- 7 files changed, 105 insertions(+), 82 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties-MERGED index 48d6c84258..594b458990 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/casemodule/Bundle.properties-MERGED @@ -60,7 +60,6 @@ Case.progressMessage.cancelling=Cancelling... Case.progressMessage.clearingTempDirectory=Clearing case temp directory... Case.progressMessage.closingApplicationServiceResources=Closing case-specific application service resources... Case.progressMessage.closingCaseDatabase=Closing case database... -Case.progressMessage.closingCaseLevelServices=Closing case-level services... Case.progressMessage.connectingToCoordSvc=Connecting to coordination service... Case.progressMessage.creatingCaseDatabase=Creating case database... Case.progressMessage.creatingCaseDirectory=Creating case directory... diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/Case.java b/Core/src/org/sleuthkit/autopsy/casemodule/Case.java index 640f4f8825..f455a0c9fb 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/Case.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/Case.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2019 Basis Technology Corp. + * Copyright 2012-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,7 +27,6 @@ import java.awt.event.ActionListener; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.io.File; -import java.io.IOException; import java.nio.file.InvalidPathException; import java.nio.file.Path; import java.nio.file.Paths; @@ -36,7 +35,6 @@ import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Collection; import java.util.Date; @@ -2413,7 +2411,6 @@ public class Case { @Messages({ "Case.progressMessage.shuttingDownNetworkCommunications=Shutting down network communications...", "Case.progressMessage.closingApplicationServiceResources=Closing case-specific application service resources...", - "Case.progressMessage.closingCaseLevelServices=Closing case-level services...", "Case.progressMessage.closingCaseDatabase=Closing case database..." }) private void close(ProgressIndicator progressIndicator) { @@ -2439,19 +2436,7 @@ public class Case { closeAppServiceCaseResources(); /* - * Close the case-level services. - */ - if (null != caseServices) { - progressIndicator.progress(Bundle.Case_progressMessage_closingCaseLevelServices()); - try { - this.caseServices.close(); - } catch (IOException ex) { - logger.log(Level.SEVERE, String.format("Error closing internal case services for %s at %s", this.getName(), this.getCaseDirectory()), ex); - } - } - - /* - * Close the case database + * Close the case database. */ if (null != caseDb) { progressIndicator.progress(Bundle.Case_progressMessage_closingCaseDatabase()); diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/Blackboard.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/Blackboard.java index 0353765c0f..a1289a1b85 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/Blackboard.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/Blackboard.java @@ -15,9 +15,13 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * TODO (AUT-2158): This class should not extend Closeable. */ package org.sleuthkit.autopsy.casemodule.services; +import java.io.Closeable; +import java.io.IOException; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; @@ -29,7 +33,7 @@ import org.sleuthkit.datamodel.BlackboardAttribute; * @deprecated Use org.sleuthkit.datamodel.Blackboard instead. */ @Deprecated -public final class Blackboard { +public final class Blackboard implements Closeable { /** * Constructs a representation of the blackboard, a place where artifacts @@ -105,6 +109,21 @@ public final class Blackboard { } } + /** + * Closes the artifacts blackboard. + * + * @throws IOException If there is a problem closing the artifacts + * blackboard. + * @deprecated Do not use. + */ + @Deprecated + public void close() throws IOException { + /* + * No-op maintained for backwards compatibility. Clients should not + * attempt to close case services. + */ + } + /** * A blackboard exception. * diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/FileManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/FileManager.java index 31ccf6bac7..36d88b8413 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/FileManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/FileManager.java @@ -2,8 +2,7 @@ * * Autopsy Forensic Browser * - * Copyright 2011-2018 Basis Technology Corp. - * + * Copyright 2012-2019 Basis Technology Corp. * Copyright 2012 42six Solutions. * Contact: aebadirad 42six com * Project Contact/Architect: carrier sleuthkit org @@ -19,6 +18,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * TODO (AUT-2158): This class should not extend Closeable. */ package org.sleuthkit.autopsy.casemodule.services; @@ -87,25 +88,26 @@ public class FileManager implements Closeable { } return caseDb.findAllFilesWhere(createFileTypeInCondition(mimeTypes)); } - + /** - * Finds all parent_paths that match the specified parentPath and are in the specified data source. - * + * Finds all parent_paths that match the specified parentPath and are in the + * specified data source. + * * @param dataSourceObjectID - the id of the data source to get files from - * @param parentPath - the parent path that all files should be like - * + * @param parentPath - the parent path that all files should be like + * * @return The list of files - * - * @throws TskCoreException If there is a problem querying the case + * + * @throws TskCoreException If there is a problem querying the case * database. */ public synchronized List findFilesByParentPath(long dataSourceObjectID, String parentPath) throws TskCoreException { if (null == caseDb) { throw new TskCoreException("File manager has been closed"); } - return caseDb.findAllFilesWhere(createParentPathCondition(dataSourceObjectID,parentPath)); + return caseDb.findAllFilesWhere(createParentPathCondition(dataSourceObjectID, parentPath)); } - + /** * Finds all files in a given data source (image, local/logical files set, * etc.) with types that match one of a collection of MIME types. @@ -138,18 +140,18 @@ public class FileManager implements Closeable { } /** - * Converts a data source object id and a parent path into SQL + * Converts a data source object id and a parent path into SQL * data_source_obj_id = ? AND parent_path LIKE ?% - * + * * @param dataSourceObjectID * @param parentPath - * @return + * + * @return */ - private static String createParentPathCondition(long dataSourceObjectID, String parentPath){ - return "data_source_obj_id = " + dataSourceObjectID +" AND parent_path LIKE '" + parentPath +"%'"; + private static String createParentPathCondition(long dataSourceObjectID, String parentPath) { + return "data_source_obj_id = " + dataSourceObjectID + " AND parent_path LIKE '" + parentPath + "%'"; } - - + /** * Finds all files and directories with a given file name. The name search * is for full or partial matches and is case insensitive (a case @@ -180,8 +182,10 @@ public class FileManager implements Closeable { * case insensitive (a case insensitive SQL LIKE clause is used to query the * case database). * - * @param fileName The full name or a pattern to match on part of the name - * @param parentSubString Substring that must exist in parent path. Will be surrounded by % in LIKE query. + * @param fileName The full name or a pattern to match on part of the + * name + * @param parentSubString Substring that must exist in parent path. Will be + * surrounded by % in LIKE query. * * @return The matching files and directories. * @@ -233,7 +237,7 @@ public class FileManager implements Closeable { * LIKE clause is used to query the case database). * * @param dataSource The data source. - * @param fileName The full name or a pattern to match on part of the name + * @param fileName The full name or a pattern to match on part of the name * * @return The matching files and directories. * @@ -254,9 +258,11 @@ public class FileManager implements Closeable { * insensitive (a case insensitive SQL LIKE clause is used to query the case * database). * - * @param dataSource The data source. - * @param fileName The full name or a pattern to match on part of the name - * @param parentSubString Substring that must exist in parent path. Will be surrounded by % in LIKE query. + * @param dataSource The data source. + * @param fileName The full name or a pattern to match on part of the + * name + * @param parentSubString Substring that must exist in parent path. Will be + * surrounded by % in LIKE query. * * @return The matching files and directories. * @@ -278,7 +284,7 @@ public class FileManager implements Closeable { * database). * * @param dataSource The data source. - * @param fileName The full name or a pattern to match on part of the name + * @param fileName The full name or a pattern to match on part of the name * @param parent The parent file or directory. * * @return The matching files and directories. @@ -360,6 +366,7 @@ public class FileManager implements Closeable { ctime, crtime, atime, mtime, isFile, parentObj, rederiveDetails, toolName, toolVersion, otherDetails, encodingType); } + /** * Update a derived file which already exists in the the case. * @@ -370,7 +377,7 @@ public class FileManager implements Closeable { * @param ctime The change time of the file. * @param crtime The create time of the file * @param atime The accessed time of the file. - * @param mimeType The MIME type the updated file should have, null + * @param mimeType The MIME type the updated file should have, null * to unset it * @param mtime The modified time of the file. * @param isFile True if a file, false if a directory. @@ -614,10 +621,15 @@ public class FileManager implements Closeable { * Closes the file manager. * * @throws IOException If there is a problem closing the file manager. + * @deprecated Do not use. */ + @Deprecated @Override public synchronized void close() throws IOException { - caseDb = null; + /* + * No-op maintained for backwards compatibility. Clients should not + * attempt to close case services. + */ } /** @@ -754,7 +766,7 @@ public class FileManager implements Closeable { * the parent local directory. * @param localFile The local/logical file or directory. * @param progressUpdater notifier to receive progress notifications on - * folders added, or null if not used. Called after + * folders added, or null if not used. Called after * each file/directory is added to the case database. * * @return An AbstractFile representation of the local/logical file. diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java index e5edd14ebd..2151193e97 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java @@ -33,10 +33,11 @@ import org.sleuthkit.datamodel.SleuthkitCase; /** * A collection of case-level services: file manager, tags manager, keyword * search service, artifacts blackboard. + * + * TODO (AUT-2158): This interface should not extend Closeable. */ public class Services implements Closeable { - private final List services = new ArrayList<>(); private final FileManager fileManager; private final TagsManager tagsManager; private final KeywordSearchService keywordSearchService; @@ -49,16 +50,8 @@ public class Services implements Closeable { */ public Services(SleuthkitCase caseDb) { fileManager = new FileManager(caseDb); - services.add(fileManager); - tagsManager = new TagsManager(caseDb); - services.add(tagsManager); - - //This lookup fails in the functional test code. See JIRA-4571 for details. - //For the time being, the closing of this service at line 108 will be made - //null safe so that the functional tests run with no issues. keywordSearchService = Lookup.getDefault().lookup(KeywordSearchService.class); - services.add(keywordSearchService); } /** @@ -115,14 +108,15 @@ public class Services implements Closeable { * Closes the services for the current case. * * @throws IOException if there is a problem closing the services. + * @deprecated Do not use. */ + @Deprecated @Override public void close() throws IOException { - for (Closeable service : services) { - if (service != null) { - service.close(); - } - } + /* + * No-op maintained for backwards compatibility. Clients should not + * attempt to close case services. + */ } } diff --git a/Core/src/org/sleuthkit/autopsy/keywordsearchservice/KeywordSearchService.java b/Core/src/org/sleuthkit/autopsy/keywordsearchservice/KeywordSearchService.java index d033a36a0f..cbbcd35751 100644 --- a/Core/src/org/sleuthkit/autopsy/keywordsearchservice/KeywordSearchService.java +++ b/Core/src/org/sleuthkit/autopsy/keywordsearchservice/KeywordSearchService.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2018 Basis Technology Corp. + * Copyright 2015-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,17 +19,23 @@ package org.sleuthkit.autopsy.keywordsearchservice; import java.io.Closeable; +import java.io.IOException; import org.sleuthkit.autopsy.casemodule.CaseMetadata; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; /** - * An interface for implementations of a keyword search service. - * You can find the implementations by using Lookup, such as: - * Lookup.getDefault().lookup(KeywordSearchService.class) + * An interface for implementations of a keyword search service. You can find + * the implementations by using Lookup, such as: + * + * Lookup.getDefault().lookup(KeywordSearchService.class) + * + * although most clients should obtain a keyword search service by calling: + * + * Case.getCurrentCase().getServices().getKeywordSearchService() * - * TODO (AUT-2158: This interface should not extend Closeable. + * TODO (AUT-2158): This interface should not extend Closeable. */ public interface KeywordSearchService extends Closeable { @@ -48,20 +54,19 @@ public interface KeywordSearchService extends Closeable { * all of its attributes. * * @param artifact The artifact to index. - * - * @deprecated Call org.sleuthkit.datamodel.Blackboard.postArtifact - * instead. + * + * @deprecated Call org.sleuthkit.datamodel.Blackboard.postArtifact instead. * * @throws org.sleuthkit.datamodel.TskCoreException */ - @Deprecated + @Deprecated public void indexArtifact(BlackboardArtifact artifact) throws TskCoreException; /** - * Add the given Content object to the text index. This message should only - * be used in atypical cases, such as indexing a report. Artifacts are indexed - * when org.sleuthkit.datamodel.Blackboard.postArtifact - * is called and files are indexed during ingest. + * Add the given Content object to the text index. This message should only + * be used in atypical cases, such as indexing a report. Artifacts are + * indexed when org.sleuthkit.datamodel.Blackboard.postArtifact is called + * and files are indexed during ingest. * * @param content The content to index. * @@ -77,5 +82,18 @@ public interface KeywordSearchService extends Closeable { * @throws KeywordSearchServiceException if unable to delete. */ public void deleteTextIndex(CaseMetadata metadata) throws KeywordSearchServiceException; + + /** + * Closes the keyword search service. + * + * @throws IOException If there is a problem closing the file manager. + * @deprecated Do not use. + */ + default public void close() throws IOException { + /* + * No-op maintained for backwards compatibility. Clients should not + * attempt to close case services. + */ + } } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/SolrSearchService.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/SolrSearchService.java index fdceb5bbb4..9efe326e8c 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/SolrSearchService.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/SolrSearchService.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2015-2018 Basis Technology Corp. + * Copyright 2015-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -62,8 +62,8 @@ import org.sleuthkit.datamodel.TskCoreException; @ServiceProviders(value = { @ServiceProvider(service = KeywordSearchService.class) , - @ServiceProvider(service = AutopsyService.class)} -) + @ServiceProvider(service = AutopsyService.class) +}) public class SolrSearchService implements KeywordSearchService, AutopsyService { private static final String BAD_IP_ADDRESS_FORMAT = "ioexception occurred when talking to server"; //NON-NLS @@ -136,7 +136,7 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService { // Try the StringsTextExtractor if Tika extractions fails. TextExtractor stringsExtractor = TextExtractorFactory.getStringsExtractor(content, null); Reader stringsExtractedTextReader = stringsExtractor.getReader(); - ingester.indexText(stringsExtractedTextReader,content.getId(),content.getName(), content, null); + ingester.indexText(stringsExtractedTextReader, content.getId(), content.getName(), content, null); } catch (Ingester.IngesterException | TextExtractor.InitReaderException ex1) { throw new TskCoreException("Error indexing content", ex1); } @@ -238,10 +238,6 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService { "SolrSearchService.exceptionMessage.noCurrentSolrCore")); } - @Override - public void close() throws IOException { - } - @Override public String getServiceName() { return NbBundle.getMessage(this.getClass(), "SolrSearchService.ServiceName"); From 82605de1410380d51bd8d0b9ebfcf45fcf741ef5 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Mon, 12 Aug 2019 16:44:45 -0400 Subject: [PATCH 5/8] Implement backwards compatible fix for closeable case services --- .../sleuthkit/autopsy/casemodule/services/Services.java | 8 ++------ .../keywordsearchservice/KeywordSearchService.java | 1 + 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java index 2151193e97..21dd33182b 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/Services.java @@ -23,8 +23,6 @@ package org.sleuthkit.autopsy.casemodule.services; import java.io.Closeable; 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; @@ -34,13 +32,12 @@ import org.sleuthkit.datamodel.SleuthkitCase; * A collection of case-level services: file manager, tags manager, keyword * search service, artifacts blackboard. * - * TODO (AUT-2158): This interface should not extend Closeable. + * TODO (AUT-2158): This class should not extend Closeable. */ public class Services implements Closeable { private final FileManager fileManager; private final TagsManager tagsManager; - private final KeywordSearchService keywordSearchService; /** * Constructs a collection of case-level services: file manager, tags @@ -51,7 +48,6 @@ public class Services implements Closeable { public Services(SleuthkitCase caseDb) { fileManager = new FileManager(caseDb); tagsManager = new TagsManager(caseDb); - keywordSearchService = Lookup.getDefault().lookup(KeywordSearchService.class); } /** @@ -78,7 +74,7 @@ public class Services implements Closeable { * @return The keyword search service for the current case. */ public KeywordSearchService getKeywordSearchService() { - return keywordSearchService; + return Lookup.getDefault().lookup(KeywordSearchService.class); } /** diff --git a/Core/src/org/sleuthkit/autopsy/keywordsearchservice/KeywordSearchService.java b/Core/src/org/sleuthkit/autopsy/keywordsearchservice/KeywordSearchService.java index cbbcd35751..fdd85b4609 100644 --- a/Core/src/org/sleuthkit/autopsy/keywordsearchservice/KeywordSearchService.java +++ b/Core/src/org/sleuthkit/autopsy/keywordsearchservice/KeywordSearchService.java @@ -89,6 +89,7 @@ public interface KeywordSearchService extends Closeable { * @throws IOException If there is a problem closing the file manager. * @deprecated Do not use. */ + @Deprecated default public void close() throws IOException { /* * No-op maintained for backwards compatibility. Clients should not From 63fbdca8d889fbf7a45db27c8cf9a49088ee1130 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Mon, 12 Aug 2019 17:08:45 -0400 Subject: [PATCH 6/8] renaming files ending with tests to test --- ...Tests.java => CommonAttributeSearchInterCaseTest.java} | 6 +++--- ...java => IngestedWithHashAndFileTypeInterCaseTest.java} | 6 +++--- ...java => IngestedWithHashAndFileTypeIntraCaseTest.java} | 8 ++++---- ...sts.java => IngestedWithNoFileTypesIntraCaseTest.java} | 8 ++++---- ....java => MatchesInAtLeastTwoSourcesIntraCaseTest.java} | 8 ++++---- ...raCaseTests.java => UningestedCasesIntraCaseTest.java} | 6 +++--- 6 files changed, 21 insertions(+), 21 deletions(-) rename Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/{CommonAttributeSearchInterCaseTests.java => CommonAttributeSearchInterCaseTest.java} (97%) rename Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/{IngestedWithHashAndFileTypeInterCaseTests.java => IngestedWithHashAndFileTypeInterCaseTest.java} (98%) rename Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/{IngestedWithHashAndFileTypeIntraCaseTests.java => IngestedWithHashAndFileTypeIntraCaseTest.java} (98%) rename Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/{IngestedWithNoFileTypesIntraCaseTests.java => IngestedWithNoFileTypesIntraCaseTest.java} (94%) rename Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/{MatchesInAtLeastTwoSourcesIntraCaseTests.java => MatchesInAtLeastTwoSourcesIntraCaseTest.java} (94%) rename Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/{UningestedCasesIntraCaseTests.java => UningestedCasesIntraCaseTest.java} (95%) diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeSearchInterCaseTests.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeSearchInterCaseTest.java similarity index 97% rename from Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeSearchInterCaseTests.java rename to Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeSearchInterCaseTest.java index 1fd807dcc8..98e06350e1 100644 --- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeSearchInterCaseTests.java +++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeSearchInterCaseTest.java @@ -51,18 +51,18 @@ import org.sleuthkit.datamodel.TskCoreException; * publicly exposing the keyword search module settings fails due to a circular * dependency. */ -public class CommonAttributeSearchInterCaseTests extends NbTestCase { +public class CommonAttributeSearchInterCaseTest extends NbTestCase { private final InterCaseTestUtils utils; public static Test suite() { - NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(CommonAttributeSearchInterCaseTests.class). + NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(CommonAttributeSearchInterCaseTest.class). clusters(".*"). enableModules(".*"); return conf.suite(); } - public CommonAttributeSearchInterCaseTests(String name) { + public CommonAttributeSearchInterCaseTest(String name) { super(name); this.utils = new InterCaseTestUtils(this); } diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithHashAndFileTypeInterCaseTests.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithHashAndFileTypeInterCaseTest.java similarity index 98% rename from Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithHashAndFileTypeInterCaseTests.java rename to Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithHashAndFileTypeInterCaseTest.java index acf2cad93a..e473a94164 100644 --- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithHashAndFileTypeInterCaseTests.java +++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithHashAndFileTypeInterCaseTest.java @@ -47,18 +47,18 @@ import org.sleuthkit.datamodel.TskCoreException; * all data sources: One node for Hash C (3_1_C.jpg, 3_2_C.jpg) * */ -public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase { +public class IngestedWithHashAndFileTypeInterCaseTest extends NbTestCase { private final InterCaseTestUtils utils; public static Test suite() { - NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(IngestedWithHashAndFileTypeInterCaseTests.class). + NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(IngestedWithHashAndFileTypeInterCaseTest.class). clusters(".*"). enableModules(".*"); return conf.suite(); } - public IngestedWithHashAndFileTypeInterCaseTests(String name) { + public IngestedWithHashAndFileTypeInterCaseTest(String name) { super(name); this.utils = new InterCaseTestUtils(this); } diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithHashAndFileTypeIntraCaseTests.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithHashAndFileTypeIntraCaseTest.java similarity index 98% rename from Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithHashAndFileTypeIntraCaseTests.java rename to Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithHashAndFileTypeIntraCaseTest.java index 51d731517a..b97c17cca9 100644 --- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithHashAndFileTypeIntraCaseTests.java +++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithHashAndFileTypeIntraCaseTest.java @@ -48,10 +48,10 @@ import org.sleuthkit.datamodel.TskCoreException; /** * Add set 1, set 2, set 3, and set 4 to case and ingest with hash algorithm. */ -public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase { +public class IngestedWithHashAndFileTypeIntraCaseTest extends NbTestCase { public static Test suite() { - NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(IngestedWithHashAndFileTypeIntraCaseTests.class). + NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(IngestedWithHashAndFileTypeIntraCaseTest.class). clusters(".*"). enableModules(".*"); return conf.suite(); @@ -59,7 +59,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase { private final IntraCaseTestUtils utils; - public IngestedWithHashAndFileTypeIntraCaseTests(String name) { + public IngestedWithHashAndFileTypeIntraCaseTest(String name) { super(name); this.utils = new IntraCaseTestUtils(this, "IngestedWithHashAndFileTypeTests"); @@ -76,7 +76,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase { templates.add(hashLookupTemplate); templates.add(mimeTypeLookupTemplate); - IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestedWithHashAndFileTypeIntraCaseTests.class.getCanonicalName(), IngestType.FILES_ONLY, templates); + IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestedWithHashAndFileTypeIntraCaseTest.class.getCanonicalName(), IngestType.FILES_ONLY, templates); try { IngestUtils.runIngestJob(Case.getCurrentCaseThrows().getDataSources(), ingestJobSettings); diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithNoFileTypesIntraCaseTests.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithNoFileTypesIntraCaseTest.java similarity index 94% rename from Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithNoFileTypesIntraCaseTests.java rename to Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithNoFileTypesIntraCaseTest.java index a1f435c45e..9556ef69f6 100644 --- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithNoFileTypesIntraCaseTests.java +++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/IngestedWithNoFileTypesIntraCaseTest.java @@ -51,10 +51,10 @@ import org.sleuthkit.datamodel.TskCoreException; * Add images set 1, set 2, set 3, and set 4 to case. Do not run mime type * module. */ -public class IngestedWithNoFileTypesIntraCaseTests extends NbTestCase { +public class IngestedWithNoFileTypesIntraCaseTest extends NbTestCase { public static Test suite() { - NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(IngestedWithNoFileTypesIntraCaseTests.class). + NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(IngestedWithNoFileTypesIntraCaseTest.class). clusters(".*"). enableModules(".*"); return conf.suite(); @@ -62,7 +62,7 @@ public class IngestedWithNoFileTypesIntraCaseTests extends NbTestCase { private final IntraCaseTestUtils utils; - public IngestedWithNoFileTypesIntraCaseTests(String name) { + public IngestedWithNoFileTypesIntraCaseTest(String name) { super(name); this.utils = new IntraCaseTestUtils(this, "IngestedWithNoFileTypes"); @@ -77,7 +77,7 @@ public class IngestedWithNoFileTypesIntraCaseTests extends NbTestCase { ArrayList templates = new ArrayList<>(); templates.add(hashLookupTemplate); - IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestedWithNoFileTypesIntraCaseTests.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates); + IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestedWithNoFileTypesIntraCaseTest.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates); try { IngestUtils.runIngestJob(Case.getCurrentCaseThrows().getDataSources(), ingestJobSettings); diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/MatchesInAtLeastTwoSourcesIntraCaseTests.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/MatchesInAtLeastTwoSourcesIntraCaseTest.java similarity index 94% rename from Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/MatchesInAtLeastTwoSourcesIntraCaseTests.java rename to Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/MatchesInAtLeastTwoSourcesIntraCaseTest.java index 8d42a401b9..5663ec151c 100644 --- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/MatchesInAtLeastTwoSourcesIntraCaseTests.java +++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/MatchesInAtLeastTwoSourcesIntraCaseTest.java @@ -53,10 +53,10 @@ import org.sleuthkit.datamodel.TskCoreException; * * None of the test files should be found in the results of this test. */ -public class MatchesInAtLeastTwoSourcesIntraCaseTests extends NbTestCase { +public class MatchesInAtLeastTwoSourcesIntraCaseTest extends NbTestCase { public static Test suite() { - NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(MatchesInAtLeastTwoSourcesIntraCaseTests.class). + NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(MatchesInAtLeastTwoSourcesIntraCaseTest.class). clusters(".*"). enableModules(".*"); return conf.suite(); @@ -64,7 +64,7 @@ public class MatchesInAtLeastTwoSourcesIntraCaseTests extends NbTestCase { private final IntraCaseTestUtils utils; - public MatchesInAtLeastTwoSourcesIntraCaseTests(String name) { + public MatchesInAtLeastTwoSourcesIntraCaseTest(String name) { super(name); this.utils = new IntraCaseTestUtils(this, "MatchesInAtLeastTwoSources"); @@ -86,7 +86,7 @@ public class MatchesInAtLeastTwoSourcesIntraCaseTests extends NbTestCase { templates.add(hashLookupTemplate); templates.add(mimeTypeLookupTemplate); - IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestedWithHashAndFileTypeIntraCaseTests.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates); + IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestedWithHashAndFileTypeIntraCaseTest.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates); try { IngestUtils.runIngestJob(Case.getCurrentCaseThrows().getDataSources(), ingestJobSettings); diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/UningestedCasesIntraCaseTests.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/UningestedCasesIntraCaseTest.java similarity index 95% rename from Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/UningestedCasesIntraCaseTests.java rename to Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/UningestedCasesIntraCaseTest.java index f042249fe7..8b5818d893 100644 --- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/UningestedCasesIntraCaseTests.java +++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonpropertiessearch/UningestedCasesIntraCaseTest.java @@ -45,10 +45,10 @@ import org.sleuthkit.datamodel.TskCoreException; * Add images set 1, set 2, set 3, and set 4 to case. Do not ingest. * */ -public class UningestedCasesIntraCaseTests extends NbTestCase { +public class UningestedCasesIntraCaseTest extends NbTestCase { public static Test suite() { - NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(UningestedCasesIntraCaseTests.class). + NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(UningestedCasesIntraCaseTest.class). clusters(".*"). enableModules(".*"); return conf.suite(); @@ -56,7 +56,7 @@ public class UningestedCasesIntraCaseTests extends NbTestCase { private final IntraCaseTestUtils utils; - public UningestedCasesIntraCaseTests(String name) { + public UningestedCasesIntraCaseTest(String name) { super(name); this.utils = new IntraCaseTestUtils(this, "UningestedCasesTests"); From 109fb0559317d95121bbbd175eb3f262e7ca3755 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 13 Aug 2019 12:44:30 -0400 Subject: [PATCH 7/8] Fixed the way CSV are split --- test/script/tskdbdiff.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/script/tskdbdiff.py b/test/script/tskdbdiff.py index 54a7b624ae..1a9d6b4308 100644 --- a/test/script/tskdbdiff.py +++ b/test/script/tskdbdiff.py @@ -11,6 +11,7 @@ import sys import psycopg2 import psycopg2.extras import socket +import csv class TskDbDiff(object): """Compares two TSK/Autospy SQLite databases. @@ -436,8 +437,8 @@ def normalize_db_entry(line, files_table, vs_parts_table, vs_info_table, fs_info ig_groups_seen_index = line.find('INSERT INTO "image_gallery_groups_seen"') > -1 or line.find('INSERT INTO image_gallery_groups_seen ') > -1 parens = line[line.find('(') + 1 : line.rfind(')')] - fields_list = parens.replace(" ", "").split(',') - + fields_list = list(csv.reader([parens], quotechar="'"))[0] + # remove object ID if files_index: newLine = ('INSERT INTO "tsk_files" VALUES(' + ', '.join(fields_list[1:]) + ');') From 9029b0476a0f2f4b219a477102a4ecbb2f4a6f43 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 13 Aug 2019 12:50:47 -0400 Subject: [PATCH 8/8] Added back in the replace statement --- test/script/tskdbdiff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/script/tskdbdiff.py b/test/script/tskdbdiff.py index 1a9d6b4308..5b7cd62c10 100644 --- a/test/script/tskdbdiff.py +++ b/test/script/tskdbdiff.py @@ -437,7 +437,7 @@ def normalize_db_entry(line, files_table, vs_parts_table, vs_info_table, fs_info ig_groups_seen_index = line.find('INSERT INTO "image_gallery_groups_seen"') > -1 or line.find('INSERT INTO image_gallery_groups_seen ') > -1 parens = line[line.find('(') + 1 : line.rfind(')')] - fields_list = list(csv.reader([parens], quotechar="'"))[0] + fields_list = list(csv.reader([parens.replace(" ", "")], quotechar="'"))[0] # remove object ID if files_index: