From 94b156bbfd6c27996091237a4e09378fcd593fb4 Mon Sep 17 00:00:00 2001 From: Raman Date: Fri, 15 Dec 2017 13:52:23 -0500 Subject: [PATCH] 922: Put DataSource name in AccountDeviceInstanceKey - address review comments --- .../communications/AccountsRootChildren.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountsRootChildren.java b/Core/src/org/sleuthkit/autopsy/communications/AccountsRootChildren.java index fec972b463..63e1e17d82 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountsRootChildren.java +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountsRootChildren.java @@ -56,10 +56,10 @@ class AccountsRootChildren extends ChildFactory { protected boolean createKeys(List list) { List accountDeviceInstanceKeys = new ArrayList<>(); try { - for (AccountDeviceInstance adi : commsManager.getAccountDeviceInstancesWithRelationships(commsFilter)) { - long communicationsCount = commsManager.getRelationshipSourcesCount(adi, commsFilter); - String dataSourceName = getDataSourceName(adi); - accountDeviceInstanceKeys.add(new AccountDeviceInstanceKey(adi, commsFilter, communicationsCount, dataSourceName)); + for (AccountDeviceInstance accountDeviceInstance : commsManager.getAccountDeviceInstancesWithRelationships(commsFilter)) { + long communicationsCount = commsManager.getRelationshipSourcesCount(accountDeviceInstance, commsFilter); + String dataSourceName = getDataSourceName(accountDeviceInstance); + accountDeviceInstanceKeys.add(new AccountDeviceInstanceKey(accountDeviceInstance, commsFilter, communicationsCount, dataSourceName)); }; } catch (TskCoreException tskCoreException) { logger.log(Level.SEVERE, "Error getting filtered account device instances", tskCoreException); @@ -74,18 +74,18 @@ class AccountsRootChildren extends ChildFactory { return new AccountDeviceInstanceNode(key, commsManager); } - private String getDataSourceName(AccountDeviceInstance adi) { + private String getDataSourceName(AccountDeviceInstance accountDeviceInstance) { try { final SleuthkitCase sleuthkitCase = Case.getCurrentCase().getSleuthkitCase(); for (DataSource dataSource : sleuthkitCase.getDataSources()) { - if (dataSource.getDeviceId().equals(adi.getDeviceId())) { + if (dataSource.getDeviceId().equals(accountDeviceInstance.getDeviceId())) { return sleuthkitCase.getContentById(dataSource.getId()).getName(); } } } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Error getting datasource name, falling back on device ID.", ex); } - return adi.getDeviceId(); + return accountDeviceInstance.getDeviceId(); } /**