19 package org.sleuthkit.autopsy.datamodel;
21 import java.text.SimpleDateFormat;
22 import java.util.TimeZone;
23 import java.util.logging.Level;
25 import org.openide.util.NbBundle;
41 BlackboardArtifact artifact;
44 private static final SimpleDateFormat
dateFormatter =
new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
51 @SuppressWarnings(
"deprecation")
53 if (stringContent.isEmpty()) {
55 StringBuilder buffer =
new StringBuilder();
56 buffer.append(
"<html>\n");
57 buffer.append(
"<body>\n");
60 buffer.append(
"<h4>");
61 buffer.append(artifact.getDisplayName());
62 buffer.append(
"</h4>\n");
65 buffer.append(
"<table border='0'>");
66 buffer.append(
"<tr>");
67 buffer.append(
"</tr>\n");
70 for (BlackboardAttribute attr : artifact.getAttributes()) {
73 buffer.append(
"<tr><td>");
74 buffer.append(attr.getAttributeType().getDisplayName());
75 buffer.append(
"</td>");
78 buffer.append(
"<td>");
79 switch (attr.getAttributeType().getValueType()) {
81 String str = attr.getValueString();
82 str = str.replaceAll(
" ",
" ");
83 str = str.replaceAll(
"<",
"<");
84 str = str.replaceAll(
">",
">");
85 str = str.replaceAll(
"(\r\n|\n)",
"<br />");
92 buffer.append(attr.getDisplayString());
95 long epoch = attr.getValueLong();
96 String time =
"0000-00-00 00:00:00";
99 time = dateFormatter.format(
new java.util.Date(epoch * 1000));
104 if (!
"".equals(attr.getContext())) {
106 buffer.append(attr.getContext());
109 buffer.append(
"</td>");
110 buffer.append(
"</tr>\n");
117 path = content.getUniquePath();
118 }
catch (TskCoreException ex) {
119 logger.log(Level.SEVERE,
"Exception while calling Content.getUniquePath() on {0} : {1}",
new Object[]{content, ex.getLocalizedMessage()});
123 buffer.append(
"<tr>");
124 buffer.append(
"<td>");
125 buffer.append(NbBundle.getMessage(
this.getClass(),
"ArtifactStringContent.getStr.srcFilePath.text"));
126 buffer.append(
"</td>");
127 buffer.append(
"<td>");
129 buffer.append(
"</td>");
130 buffer.append(
"</tr>\n");
133 buffer.append(
"<tr><td>");
134 buffer.append(NbBundle.getMessage(
this.getClass(),
"ArtifactStringContent.getStr.artifactId.text"));
135 buffer.append(
"</td><td>");
136 buffer.append(artifact.getArtifactID());
137 buffer.append(
"</td>");
138 buffer.append(
"</tr>\n");
140 buffer.append(
"</table>");
141 buffer.append(
"</html>\n");
143 stringContent = buffer.toString();
144 }
catch (TskException ex) {
145 stringContent = NbBundle.getMessage(this.getClass(),
"ArtifactStringContent.getStr.err");
154 return artifact.getSleuthkitCase().getContentById(artifact.getObjectID());
155 }
catch (TskException ex) {
156 logger.log(Level.WARNING,
"Getting file failed", ex);
158 throw new IllegalArgumentException(NbBundle.getMessage(
ArtifactStringContent.class,
"ArtifactStringContent.exception.msg"));
161 private static TimeZone
getTimeZone(BlackboardArtifact artifact) {
static final SimpleDateFormat dateFormatter
static Content getAssociatedContent(BlackboardArtifact artifact)
static TimeZone getTimeZone(BlackboardArtifact artifact)
synchronized static Logger getLogger(String name)
static TimeZone getTimeZone(Content c)
ArtifactStringContent(BlackboardArtifact art)