From a3c34329fcae93b20e5268a95c76870cb910bedd Mon Sep 17 00:00:00 2001 From: Mark McKinnon Date: Fri, 20 Sep 2019 16:54:54 -0400 Subject: [PATCH] Update EncryptionDetectionFileIngestModule.java make map static and address codacy issue --- .../EncryptionDetectionFileIngestModule.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionFileIngestModule.java index 1bc96cd78d..e405c19c15 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/encryptiondetection/EncryptionDetectionFileIngestModule.java @@ -78,7 +78,7 @@ final class EncryptionDetectionFileIngestModule extends FileIngestModuleAdapter private static final String[] FILE_IGNORE_LIST = {"hiberfile.sys", "pagefile.sys"}; - private final Map knownEncryptedLocationExtensions = createLocationExtensionMap(); + private static final Map knownEncryptedLocationExtensions = createLocationExtensionMap(); private final IngestServices services = IngestServices.getInstance(); private final Logger logger = services.getLogger(EncryptionDetectionModuleFactory.getModuleName()); @@ -427,20 +427,21 @@ final class EncryptionDetectionFileIngestModule extends FileIngestModuleAdapter */ private boolean checkFileLocationExtension(AbstractFile file) { String filePath = file.getParentPath().replace("/", ""); - if (knownEncryptedLocationExtensions.containsKey(filePath)) { - if (knownEncryptedLocationExtensions.get(filePath).equals(file.getNameExtension())) { - return true; - } + if ((knownEncryptedLocationExtensions.containsKey(filePath)) + && (knownEncryptedLocationExtensions.get(filePath).equals(file.getNameExtension()))) + { + return true; } return false; } - + /* - * This method creates the map of paths and extensions that are known to have encrypted files - * + * This method creates the map of paths and extensions that are known to + * have encrypted files + * * @return Map of path and extension of files */ - private Map createLocationExtensionMap() { + private static Map createLocationExtensionMap() { Map locationExtensionMap = new HashMap(); locationExtensionMap.put(".android_secure", "asec"); return locationExtensionMap;