diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/FileManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/FileManager.java index 1335d24b26..f9095876d9 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/FileManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/FileManager.java @@ -2,7 +2,7 @@ * * Autopsy Forensic Browser * - * Copyright 2012-2019 Basis Technology Corp. + * Copyright 2012-2021 Basis Technology Corp. * Copyright 2012 42six Solutions. * Contact: aebadirad 42six com * Project Contact/Architect: carrier sleuthkit org @@ -60,7 +60,7 @@ import org.sleuthkit.datamodel.TskData; public class FileManager implements Closeable { private static final Logger LOGGER = Logger.getLogger(FileManager.class.getName()); - private SleuthkitCase caseDb; + private final SleuthkitCase caseDb; /** * Constructs a manager that provides methods for retrieving files from the @@ -83,10 +83,7 @@ public class FileManager implements Closeable { * @throws TskCoreException If there is a problem querying the case * database. */ - public synchronized List findFilesByMimeType(Collection mimeTypes) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } + public List findFilesByMimeType(Collection mimeTypes) throws TskCoreException { return caseDb.findAllFilesWhere(createFileTypeInCondition(mimeTypes)); } @@ -102,10 +99,7 @@ public class FileManager implements Closeable { * @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"); - } + public List findFilesByParentPath(long dataSourceObjectID, String parentPath) throws TskCoreException { return caseDb.findAllFilesWhere(createParentPathCondition(dataSourceObjectID, parentPath)); } @@ -121,10 +115,7 @@ public class FileManager implements Closeable { * @throws TskCoreException If there is a problem querying the case * database. */ - public synchronized List findFilesByMimeType(Content dataSource, Collection mimeTypes) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } + public List findFilesByMimeType(Content dataSource, Collection mimeTypes) throws TskCoreException { return caseDb.findAllFilesWhere("data_source_obj_id = " + dataSource.getId() + " AND " + createFileTypeInCondition(mimeTypes)); } @@ -138,10 +129,7 @@ public class FileManager implements Closeable { * * @throws TskCoreException */ - public synchronized List findFilesExactName(long parentId, String name) throws TskCoreException{ - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } + public List findFilesExactName(long parentId, String name) throws TskCoreException{ String whereClause = "name = '%s'"; return caseDb.findAllFilesInFolderWhere(parentId, String.format(whereClause, name)); } @@ -183,10 +171,7 @@ public class FileManager implements Closeable { * @throws TskCoreException if there is a problem querying the case * database. */ - public synchronized List findFiles(String fileName) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } + public List findFiles(String fileName) throws TskCoreException { List result = new ArrayList<>(); List dataSources = caseDb.getRootObjects(); for (Content dataSource : dataSources) { @@ -211,10 +196,7 @@ public class FileManager implements Closeable { * @throws TskCoreException if there is a problem querying the case * database. */ - public synchronized List findFiles(String fileName, String parentSubString) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } + public List findFiles(String fileName, String parentSubString) throws TskCoreException { List result = new ArrayList<>(); List dataSources = caseDb.getRootObjects(); for (Content dataSource : dataSources) { @@ -237,10 +219,7 @@ public class FileManager implements Closeable { * @throws TskCoreException if there is a problem querying the case * database. */ - public synchronized List findFiles(String fileName, AbstractFile parent) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } + public List findFiles(String fileName, AbstractFile parent) throws TskCoreException { List result = new ArrayList<>(); List dataSources = caseDb.getRootObjects(); for (Content dataSource : dataSources) { @@ -263,10 +242,7 @@ public class FileManager implements Closeable { * @throws TskCoreException if there is a problem querying the case * database. */ - public synchronized List findFiles(Content dataSource, String fileName) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } + public List findFiles(Content dataSource, String fileName) throws TskCoreException { return caseDb.findFiles(dataSource, fileName); } @@ -288,10 +264,7 @@ public class FileManager implements Closeable { * @throws TskCoreException if there is a problem querying the case * database. */ - public synchronized List findFiles(Content dataSource, String fileName, String parentSubString) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } + public List findFiles(Content dataSource, String fileName, String parentSubString) throws TskCoreException { return caseDb.findFiles(dataSource, fileName, parentSubString); } @@ -311,10 +284,7 @@ public class FileManager implements Closeable { * @throws TskCoreException if there is a problem querying the case * database. */ - public synchronized List findFiles(Content dataSource, String fileName, AbstractFile parent) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } + public List findFiles(Content dataSource, String fileName, AbstractFile parent) throws TskCoreException { return findFiles(dataSource, fileName, parent.getName()); } @@ -334,10 +304,7 @@ public class FileManager implements Closeable { * @throws TskCoreException if there is a problem querying the case * database. */ - public synchronized List openFiles(Content dataSource, String filePath) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } + public List openFiles(Content dataSource, String filePath) throws TskCoreException { return caseDb.openFiles(dataSource, filePath); } @@ -370,7 +337,7 @@ public class FileManager implements Closeable { * @throws TskCoreException if there is a problem adding the file to the * case database. */ - public synchronized DerivedFile addDerivedFile(String fileName, + public DerivedFile addDerivedFile(String fileName, String localPath, long size, long ctime, long crtime, long atime, long mtime, @@ -378,9 +345,6 @@ public class FileManager implements Closeable { Content parentObj, String rederiveDetails, String toolName, String toolVersion, String otherDetails, TskData.EncodingType encodingType) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } return caseDb.addDerivedFile(fileName, localPath, size, ctime, crtime, atime, mtime, isFile, parentObj, rederiveDetails, toolName, toolVersion, otherDetails, encodingType); @@ -416,15 +380,12 @@ public class FileManager implements Closeable { * @throws TskCoreException if there is a problem adding the file to the * case database. */ - public synchronized DerivedFile updateDerivedFile(DerivedFile derivedFile, String localPath, + public DerivedFile updateDerivedFile(DerivedFile derivedFile, String localPath, long size, long ctime, long crtime, long atime, long mtime, boolean isFile, String mimeType, String rederiveDetails, String toolName, String toolVersion, String otherDetails, TskData.EncodingType encodingType) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } return caseDb.updateDerivedFile(derivedFile, localPath, size, ctime, crtime, atime, mtime, isFile, mimeType, rederiveDetails, toolName, toolVersion, otherDetails, encodingType); @@ -441,10 +402,7 @@ public class FileManager implements Closeable { * @throws TskCoreException If there is a problem completing a case database * operation. */ - public synchronized List addCarvedFiles(CarvingResult carvingResult) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } + public List addCarvedFiles(CarvingResult carvingResult) throws TskCoreException { return caseDb.addCarvedFiles(carvingResult); } @@ -490,7 +448,7 @@ public class FileManager implements Closeable { * @throws TskDataException if any of the local file paths is for a file or * directory that does not exist or cannot be read. */ - public synchronized LocalFilesDataSource addLocalFilesDataSource(String deviceId, String rootVirtualDirectoryName, String timeZone, List localFilePaths, FileAddProgressUpdater progressUpdater) throws TskCoreException, TskDataException { + public LocalFilesDataSource addLocalFilesDataSource(String deviceId, String rootVirtualDirectoryName, String timeZone, List localFilePaths, FileAddProgressUpdater progressUpdater) throws TskCoreException, TskDataException { return addLocalFilesDataSource(deviceId, rootVirtualDirectoryName, timeZone, null, localFilePaths, progressUpdater); } @@ -523,11 +481,8 @@ public class FileManager implements Closeable { * @throws TskDataException if any of the local file paths is for a file or * directory that does not exist or cannot be read. */ - public synchronized LocalFilesDataSource addLocalFilesDataSource(String deviceId, String rootVirtualDirectoryName, String timeZone, Host host, + public LocalFilesDataSource addLocalFilesDataSource(String deviceId, String rootVirtualDirectoryName, String timeZone, Host host, List localFilePaths, FileAddProgressUpdater progressUpdater) throws TskCoreException, TskDataException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } List localFiles = getFilesAndDirectories(localFilePaths); CaseDbTransaction trans = null; try { @@ -587,7 +542,7 @@ public class FileManager implements Closeable { * @throws TskCoreException If there is a problem querying the case * database. */ - private static synchronized String generateFilesDataSourceName(SleuthkitCase caseDb) throws TskCoreException { + private static String generateFilesDataSourceName(SleuthkitCase caseDb) throws TskCoreException { int localFileDataSourcesCounter = 0; try { List localFileDataSources = caseDb.getVirtualDirectoryRoots(); @@ -678,13 +633,13 @@ public class FileManager implements Closeable { */ @Deprecated @Override - public synchronized void close() throws IOException { + public void close() throws IOException { /* * No-op maintained for backwards compatibility. Clients should not * attempt to close case services. */ - } - + } + /** * Adds a set of local/logical files and/or directories to the case database * as data source. @@ -704,10 +659,7 @@ public class FileManager implements Closeable { * @deprecated Use addLocalFilesDataSource instead. */ @Deprecated - public synchronized VirtualDirectory addLocalFilesDirs(List localFilePaths, FileAddProgressUpdater progressUpdater) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } + public VirtualDirectory addLocalFilesDirs(List localFilePaths, FileAddProgressUpdater progressUpdater) throws TskCoreException { try { return addLocalFilesDataSource("", "", "", localFilePaths, progressUpdater).getRootDirectory(); } catch (TskDataException ex) { @@ -734,10 +686,7 @@ public class FileManager implements Closeable { * carvingResult instead. */ @Deprecated - public synchronized LayoutFile addCarvedFile(String fileName, long fileSize, long parentObjId, List layout) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } + public LayoutFile addCarvedFile(String fileName, long fileSize, long parentObjId, List layout) throws TskCoreException { Content parent = caseDb.getContentById(parentObjId); List carvedFiles = new ArrayList<>(); carvedFiles.add(new CarvingResult.CarvedFile(fileName, fileSize, layout)); @@ -761,10 +710,7 @@ public class FileManager implements Closeable { * carvingResult instead. */ @Deprecated - public synchronized List addCarvedFiles(List filesToAdd) throws TskCoreException { - if (null == caseDb) { - throw new TskCoreException("File manager has been closed"); - } + public List addCarvedFiles(List filesToAdd) throws TskCoreException { return caseDb.addCarvedFiles(filesToAdd); } @@ -799,7 +745,7 @@ public class FileManager implements Closeable { * @deprecated Use the version with explicit EncodingType instead */ @Deprecated - public synchronized DerivedFile addDerivedFile(String fileName, + public DerivedFile addDerivedFile(String fileName, String localPath, long size, long ctime, long crtime, long atime, long mtime, diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/FileTypes.java b/Core/src/org/sleuthkit/autopsy/datamodel/FileTypes.java index 9d49be2d64..e5d374f6f0 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/FileTypes.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/FileTypes.java @@ -379,14 +379,14 @@ public final class FileTypes implements AutopsyVisitableItem { } @Deprecated - @SuppressWarnings("Deprecated") + @SuppressWarnings("deprecation") @Override public BlackboardArtifact newArtifact(int artifactTypeID) throws TskCoreException { return content.newArtifact(artifactTypeID); } @Deprecated - @SuppressWarnings("Deprecated") + @SuppressWarnings("deprecation") @Override public BlackboardArtifact newArtifact(BlackboardArtifact.ARTIFACT_TYPE type) throws TskCoreException { return content.newArtifact(type); @@ -396,6 +396,11 @@ public final class FileTypes implements AutopsyVisitableItem { public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection attributesList, Long osAccountId) throws TskCoreException { return content.newDataArtifact(artifactType, attributesList, osAccountId); } + + @Override + public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection attributesList) throws TskCoreException { + return content.newDataArtifact(artifactType, attributesList); + } @Override public ArrayList getArtifacts(String artifactTypeName) throws TskCoreException { diff --git a/Core/src/org/sleuthkit/autopsy/datasourceprocessors/xry/XRYDeviceGenInfoFileParser.java b/Core/src/org/sleuthkit/autopsy/datasourceprocessors/xry/XRYDeviceGenInfoFileParser.java index c9ef4459dd..895706caa3 100755 --- a/Core/src/org/sleuthkit/autopsy/datasourceprocessors/xry/XRYDeviceGenInfoFileParser.java +++ b/Core/src/org/sleuthkit/autopsy/datasourceprocessors/xry/XRYDeviceGenInfoFileParser.java @@ -106,11 +106,7 @@ final class XRYDeviceGenInfoFileParser extends AbstractSingleEntityParser { } } if(!attributes.isEmpty()) { - if (parent instanceof AbstractFile) { - parent.newDataArtifact(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_INFO), attributes); - } else { - parent.newDataArtifact(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_INFO), attributes, null); - } + parent.newDataArtifact(BlackboardArtifact.Type.TSK_DEVICE_INFO, attributes); } } diff --git a/Core/src/org/sleuthkit/autopsy/datasourceprocessors/xry/XRYWebBookmarksFileParser.java b/Core/src/org/sleuthkit/autopsy/datasourceprocessors/xry/XRYWebBookmarksFileParser.java index 8f2cc7919a..773e0a0acd 100755 --- a/Core/src/org/sleuthkit/autopsy/datasourceprocessors/xry/XRYWebBookmarksFileParser.java +++ b/Core/src/org/sleuthkit/autopsy/datasourceprocessors/xry/XRYWebBookmarksFileParser.java @@ -79,11 +79,7 @@ final class XRYWebBookmarksFileParser extends AbstractSingleEntityParser { } } if(!attributes.isEmpty()) { - if (parent instanceof AbstractFile) { - parent.newDataArtifact(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK), attributes); - } else { - parent.newDataArtifact(new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK), attributes, null); - } + parent.newDataArtifact(BlackboardArtifact.Type.TSK_WEB_BOOKMARK, attributes); } } } \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java index f52b394d4d..834adc0a97 100644 --- a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java +++ b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java @@ -114,13 +114,7 @@ final class CustomArtifactType { attr.addSource(ADDITIONAL_MODULE_NAME); } - BlackboardArtifact artifact; - - if (artifactType.getCategory() == null) { - throw new TskCoreException(String.format("Artifact type: %s has no category.", - artifactType.getDisplayName(), artifactType.getCategory().getDisplayName())); - } - + BlackboardArtifact artifact; switch (artifactType.getCategory()) { case DATA_ARTIFACT: artifact = source.newDataArtifact(artifactType, attributes); diff --git a/InternalPythonModules/android/browserlocation.py b/InternalPythonModules/android/browserlocation.py index cbf5a730ef..faab73bcfa 100644 --- a/InternalPythonModules/android/browserlocation.py +++ b/InternalPythonModules/android/browserlocation.py @@ -103,7 +103,6 @@ class BrowserLocationAnalyzer(general.AndroidComponentAnalyzer): # artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_VALUE.getTypeID(),moduleName, accuracy)) # NOTE: originally commented out - artifact.addAttributes(attributes); try: # index the artifact for keyword search blackboard = Case.getCurrentCase().getSleuthkitCase().getBlackboard() diff --git a/InternalPythonModules/android/oruxmaps.py b/InternalPythonModules/android/oruxmaps.py index 9365c838b2..677ea26eea 100644 --- a/InternalPythonModules/android/oruxmaps.py +++ b/InternalPythonModules/android/oruxmaps.py @@ -94,8 +94,7 @@ class OruxMapsAnalyzer(general.AndroidComponentAnalyzer): attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, self._MODULE_NAME, self._PROGRAM_NAME)) artifact = abstractFile.newDataArtifact(BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK), attributes) - - artifact.addAttributes(attributes) + try: # index the artifact for keyword search blackboard = Case.getCurrentCase().getSleuthkitCase().getBlackboard() diff --git a/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties b/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties index 185c4f4ea3..c2df473fe0 100644 --- a/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties +++ b/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties @@ -1,5 +1,5 @@ #Updated by build script -#Wed, 28 Apr 2021 08:03:47 -0400 +#Mon, 25 Jan 2021 12:41:22 -0500 LBL_splash_window_title=Starting Autopsy SPLASH_HEIGHT=314 SPLASH_WIDTH=538 diff --git a/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties b/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties index cb40d1abec..d519362703 100644 --- a/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties +++ b/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties @@ -1,4 +1,4 @@ #Updated by build script -#Wed, 28 Apr 2021 08:03:47 -0400 +#Mon, 25 Jan 2021 12:41:22 -0500 CTL_MainWindow_Title=Autopsy 4.18.0 CTL_MainWindow_Title_No_Project=Autopsy 4.18.0