From 0e5f72270c34229ae9afec62791ea15fd2a61101 Mon Sep 17 00:00:00 2001 From: Sophie Mori Date: Tue, 4 Oct 2016 09:48:05 -0400 Subject: [PATCH] Changed DATETIME format for artifact viewer in ArtifactStringContent --- .../datamodel/ArtifactStringContent.java | 76 ++++++++----------- 1 file changed, 32 insertions(+), 44 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/ArtifactStringContent.java b/Core/src/org/sleuthkit/autopsy/datamodel/ArtifactStringContent.java index fa59de87c1..ef434c5794 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/ArtifactStringContent.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/ArtifactStringContent.java @@ -68,58 +68,46 @@ public class ArtifactStringContent implements StringContent { buffer.append(""); //NON-NLS buffer.append("\n"); //NON-NLS - // cycle through each attribute and display in a row in the table. + // cycle through each attribute and display in a row in the table. for (BlackboardAttribute attr : artifact.getAttributes()) { // name column buffer.append(""); //NON-NLS buffer.append(attr.getAttributeType().getDisplayName()); buffer.append(""); //NON-NLS - + // value column buffer.append(""); //NON-NLS - if (attr.getAttributeType().getTypeID() == ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID() - || attr.getAttributeType().getTypeID() == ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID() - || attr.getAttributeType().getTypeID() == ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID() - || attr.getAttributeType().getTypeID() == ATTRIBUTE_TYPE.TSK_DATETIME_MODIFIED.getTypeID() - || attr.getAttributeType().getTypeID() == ATTRIBUTE_TYPE.TSK_DATETIME_RCVD.getTypeID() - || attr.getAttributeType().getTypeID() == ATTRIBUTE_TYPE.TSK_DATETIME_SENT.getTypeID() - || attr.getAttributeType().getTypeID() == ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID() - || attr.getAttributeType().getTypeID() == ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID()) { - long epoch = attr.getValueLong(); - String time = "0000-00-00 00:00:00"; - if (epoch != 0) { - dateFormatter.setTimeZone(getTimeZone(artifact)); - time = dateFormatter.format(new java.util.Date(epoch * 1000)); - } - buffer.append(time); - } else { - switch (attr.getAttributeType().getValueType()) { - case STRING: - String str = attr.getValueString(); - str = str.replaceAll(" ", " "); //NON-NLS - str = str.replaceAll("<", "<"); //NON-NLS - str = str.replaceAll(">", ">"); //NON-NLS - str = str.replaceAll("(\r\n|\n)", "
"); //NON-NLS - buffer.append(str); - break; - case INTEGER: - buffer.append(attr.getValueInt()); - break; - case LONG: - buffer.append(attr.getValueLong()); - break; - case DOUBLE: - buffer.append(attr.getValueDouble()); - break; - case BYTE: - buffer.append(Arrays.toString(attr.getValueBytes())); - break; - case DATETIME: - buffer.append(attr.getValueLong()); - break; - - } + switch (attr.getAttributeType().getValueType()) { + case STRING: + String str = attr.getValueString(); + str = str.replaceAll(" ", " "); //NON-NLS + str = str.replaceAll("<", "<"); //NON-NLS + str = str.replaceAll(">", ">"); //NON-NLS + str = str.replaceAll("(\r\n|\n)", "
"); //NON-NLS + buffer.append(str); + break; + case INTEGER: + buffer.append(attr.getValueInt()); + break; + case LONG: + buffer.append(attr.getValueLong()); + break; + case DOUBLE: + buffer.append(attr.getValueDouble()); + break; + case BYTE: + buffer.append(Arrays.toString(attr.getValueBytes())); + break; + case DATETIME: + long epoch = attr.getValueLong(); + String time = "0000-00-00 00:00:00"; + if (epoch != 0) { + dateFormatter.setTimeZone(getTimeZone(artifact)); + time = dateFormatter.format(new java.util.Date(epoch * 1000)); + } + buffer.append(time); + break; } if (!"".equals(attr.getContext())) { buffer.append(" (");