diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/osaccount/OsAccountDataPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/osaccount/OsAccountDataPanel.java index 4eef25539f..34b13471c0 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/osaccount/OsAccountDataPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/osaccount/OsAccountDataPanel.java @@ -140,8 +140,12 @@ public class OsAccountDataPanel extends JPanel { String key = rowData.getKey(); String value = rowData.getValue(); - addPropertyName(key, rowCnt); - addPropertyValue(value, rowCnt++); + if(value != null) { + addPropertyName(key, rowCnt); + addPropertyValue(value, rowCnt++); + } else { + addLabel(key, rowCnt++); + } } } @@ -240,24 +244,28 @@ public class OsAccountDataPanel extends JPanel { }) private SectionData buildHostData(Host host, List attributeList) { SectionData data = new SectionData(Bundle.OsAccountDataPanel_host_section_title(host.getName())); - for (OsAccountAttribute attribute : attributeList) { - String displayName = attribute.getAttributeType().getDisplayName(); - String value = attribute.getDisplayString(); - - if(attribute.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COUNT.getTypeID()) { - displayName = Bundle.OsAccountDataPanel_host_count_title(); - } else if(attribute.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_IS_ADMIN.getTypeID()) { - displayName = Bundle.OsAccountDataPanel_administrator_title(); - if(attribute.getValueInt() == 0) { - value = "False"; - } else { - value = "True"; + if(attributeList != null) { + for (OsAccountAttribute attribute : attributeList) { + String displayName = attribute.getAttributeType().getDisplayName(); + String value = attribute.getDisplayString(); + + if(attribute.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COUNT.getTypeID()) { + displayName = Bundle.OsAccountDataPanel_host_count_title(); + } else if(attribute.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_IS_ADMIN.getTypeID()) { + displayName = Bundle.OsAccountDataPanel_administrator_title(); + if(attribute.getValueInt() == 0) { + value = "False"; + } else { + value = "True"; + } + } else if(attribute.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID()) { + displayName = Bundle.OsAccountDataPanel_data_accessed_title(); } - } else if(attribute.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID()) { - displayName = Bundle.OsAccountDataPanel_data_accessed_title(); + + data.addData(displayName, value); } - - data.addData(displayName, value); + } else { + data.addData("No details available", null); } return data; @@ -286,6 +294,18 @@ public class OsAccountDataPanel extends JPanel { JLabel label = new JLabel(key + ":"); add(label, getPropertyNameContraints(row)); } + + /** + * Adds a simple label to the given row. + * + * @param text The text to show. + * @param row The row in the layout. + */ + private void addLabel(String text, int row) { + JLabel label = new JLabel(text); + add(label, getPropertyNameContraints(row)); + addPropertyValue("", row); + } /** * Add the property value at the given row in the layout. @@ -398,56 +418,53 @@ public class OsAccountDataPanel extends JPanel { } OsAccountRealm realm = skCase.getOsAccountRealmManager().getRealmByRealmId(account.getRealmId()); - + List hosts = osAccountManager.getHosts(account); List attributeList = account.getExtendedOsAccountAttributes(); + // Organize the attributes by hostId + Map> idMap = new HashMap<>(); if (attributeList != null) { - if (hosts != null) { - // Organize the attributes by hostId - Map> idMap = new HashMap<>(); - for (OsAccountAttribute attribute : attributeList) { - List atList = null; - Optional optionalId = attribute.getHostId(); - Long key = null; - if (optionalId.isPresent()) { - key = optionalId.get(); - } - - atList = idMap.get(key); - - if (atList == null) { - atList = new ArrayList<>(); - idMap.put(key, atList); - } - - atList.add(attribute); + for (OsAccountAttribute attribute : attributeList) { + List atList = null; + Optional optionalId = attribute.getHostId(); + Long key = null; + if (optionalId.isPresent()) { + key = optionalId.get(); } - // Add attribute lists to the hostMap - for (Host host : hosts) { - List atList = idMap.get(host.getHostId()); - if (atList != null) { - hostMap.put(host, atList); - } + atList = idMap.get(key); - } - List atList = idMap.get(null); - if (atList != null) { - hostMap.put(null, atList); + if (atList == null) { + atList = new ArrayList<>(); + idMap.put(key, atList); } - // Store both the host and the dataSource so that we get - // all of the calls to the db done in the thread. - for (OsAccountInstance instance : account.getOsAccountInstances()) { - instanceMap.put(instance.getDataSource().getHost(), instance.getDataSource()); - } - - } else { - hostMap.put(null, attributeList); + atList.add(attribute); } } + // Add attribute lists to the hostMap + if (hosts != null) { + for (Host host : hosts) { + List atList = idMap.get(host.getHostId()); + hostMap.put(host, atList); + } + } else { + hostMap.put(null, attributeList); + } + + List atList = idMap.get(null); + if (atList != null) { + hostMap.put(null, atList); + } + + // Store both the host and the dataSource so that we get + // all of the calls to the db done in the thread. + for (OsAccountInstance instance : account.getOsAccountInstances()) { + instanceMap.put(instance.getDataSource().getHost(), instance.getDataSource()); + } + return new WorkerResults(hostMap, instanceMap, realm); }