diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java index 3a71680207..6e4d0fc4c7 100644 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java @@ -67,8 +67,6 @@ import static java.util.TimeZone.getTimeZone; import org.openide.util.Lookup; import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress; import org.sleuthkit.autopsy.ingest.IngestModule.IngestModuleException; -import org.sleuthkit.autopsy.ingest.IngestServices; -import org.sleuthkit.autopsy.ingest.ModuleDataEvent; import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchService; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; @@ -876,7 +874,7 @@ class ExtractRegistry extends Extract { String userInfoSection = "User Information"; String previousLine = null; String line = bufferedReader.readLine(); - Set> userSet = new HashSet<>(); + Set> userSet = new HashSet<>(); Map> groupMap = null; while (line != null) { if (line.contains(SECTION_DIVIDER) && previousLine != null && previousLine.contains(userInfoSection)) { @@ -890,9 +888,9 @@ class ExtractRegistry extends Extract { previousLine = line; line = bufferedReader.readLine(); } - Map> userInfoMap = new HashMap<>(); + Map> userInfoMap = new HashMap<>(); //load all the user info which was read into a map - for (HashMap userInfo : userSet) { + for (Map userInfo : userSet) { userInfoMap.put(userInfo.get(SID_KEY), userInfo); } //get all existing OS account artifacts @@ -903,7 +901,7 @@ class ExtractRegistry extends Extract { BlackboardAttribute existingUserId = osAccount.getAttribute(new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_USER_ID)); if (existingUserId != null) { String userID = existingUserId.getValueString().trim(); - HashMap userInfo = userInfoMap.remove(userID); + Map userInfo = userInfoMap.remove(userID); //if the existing user id matches a user id which we parsed information for check if that information exists and if it doesn't add it if (userInfo != null) { osAccount.addAttributes(getAttributesForAccount(userInfo, groupMap.get(userID), true)); @@ -912,7 +910,7 @@ class ExtractRegistry extends Extract { } } //add remaining userinfos as accounts; - for (HashMap userInfo : userInfoMap.values()) { + for (Map userInfo : userInfoMap.values()) { BlackboardArtifact bbart = regAbstractFile.newArtifact(ARTIFACT_TYPE.TSK_OS_ACCOUNT); bbart.addAttributes(getAttributesForAccount(userInfo, groupMap.get(userInfo.get(SID_KEY)), false)); // index the artifact for keyword search @@ -943,7 +941,7 @@ class ExtractRegistry extends Extract { * * @throws ParseException */ - Collection getAttributesForAccount(HashMap userInfo, List groupList, boolean existingUser) throws ParseException { + Collection getAttributesForAccount(Map userInfo, List groupList, boolean existingUser) throws ParseException { Collection bbattributes = new ArrayList<>(); SimpleDateFormat regRipperTimeFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy 'Z'"); @@ -1062,8 +1060,8 @@ class ExtractRegistry extends Extract { getRAModuleName(), settingString)); } - if (groupList != null && groupList.size() > 0) { - String groups = new String(); + if (groupList != null && groupList.isEmpty()) { + String groups = ""; for (String group : groupList) { groups += group + ", "; } @@ -1086,7 +1084,7 @@ class ExtractRegistry extends Extract { * * @throws IOException */ - private void readUsers(BufferedReader bufferedReader, Set> users) throws IOException { + private void readUsers(BufferedReader bufferedReader, Set> users) throws IOException { String line = bufferedReader.readLine(); //read until end of file or next section divider String userName = ""; @@ -1131,7 +1129,7 @@ class ExtractRegistry extends Extract { * @throws IOException */ Map> readGroups(BufferedReader bufferedReader) throws IOException { - HashMap> groupMap = new HashMap<>(); + Map> groupMap = new HashMap<>(); String line = bufferedReader.readLine(); @@ -1193,8 +1191,6 @@ class ExtractRegistry extends Extract { value = ""; } - return new AbstractMap.SimpleEntry<>(key, value); - } else if (line.contains("-->")) { key = line.replace("-->", "").trim(); value = "true";