"); //NON-NLS
+
+ // header row
buffer.append(""); //NON-NLS
- buffer.append(""); //NON-NLS
+ buffer.append(" | "); //NON-NLS
buffer.append(Bundle.ArtifactStringContent_attrsTableHeader_type());
- buffer.append(""); //NON-NLS
- buffer.append(" | "); //NON-NLS
+ buffer.append(""); //NON-NLS
+ buffer.append(" | "); //NON-NLS
buffer.append(Bundle.ArtifactStringContent_attrsTableHeader_value());
- buffer.append(""); //NON-NLS
- buffer.append(" | "); //NON-NLS
+ buffer.append(""); //NON-NLS
+ buffer.append(" | "); //NON-NLS
buffer.append(Bundle.ArtifactStringContent_attrsTableHeader_sources());
- buffer.append(""); //NON-NLS
+ buffer.append(" | "); //NON-NLS
buffer.append("
\n"); //NON-NLS
try {
Content content = artifact.getSleuthkitCase().getContentById(artifact.getObjectID());
@@ -108,64 +110,42 @@ public class ArtifactStringContent implements StringContent {
*/
for (BlackboardAttribute attr : artifact.getAttributes()) {
- /*
- * Attribute display name column.
- */
- buffer.append(""); //NON-NLS
- buffer.append(attr.getAttributeType().getDisplayName());
- buffer.append(" | "); //NON-NLS
-
/*
* Attribute value column.
*/
- buffer.append(""); //NON-NLS
+ String value = "";
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:
case LONG:
case DOUBLE:
- buffer.append(attr.getDisplayString());
- break;
case BYTE:
- buffer.append(Arrays.toString(attr.getValueBytes()));
+ default:
+ value = attr.getDisplayString();
break;
+
+ // Use Autopsy date formatting settings, not TSK defaults
case DATETIME:
long epoch = attr.getValueLong();
- String time = "0000-00-00 00:00:00";
+ value = "0000-00-00 00:00:00";
if (null != content && 0 != epoch) {
dateFormatter.setTimeZone(ContentUtils.getTimeZone(content));
- time = dateFormatter.format(new java.util.Date(epoch * 1000));
+ value = dateFormatter.format(new java.util.Date(epoch * 1000));
}
- buffer.append(time);
break;
}
- buffer.append(" | "); //NON-NLS
/*
* Attribute sources column.
*/
- buffer.append(""); //NON-NLS
- buffer.append(StringUtils.join(attr.getSources(), ", "));
- buffer.append(" | "); //NON-NLS
-
- buffer.append("
\n"); //NON-NLS
+ String sources = StringUtils.join(attr.getSources(), ", ");
+ buffer.append(makeTableRow(attr.getAttributeType().getDisplayName(), value, sources));
}
/*
* Add a row for the source content path.
*/
- buffer.append(""); //NON-NLS
- buffer.append(""); //NON-NLS
- buffer.append(NbBundle.getMessage(this.getClass(), "ArtifactStringContent.getStr.srcFilePath.text"));
- buffer.append(" | "); //NON-NLS
- buffer.append(""); //NON-NLS
+
String path = "";
try {
if (null != content) {
@@ -175,33 +155,24 @@ public class ArtifactStringContent implements StringContent {
logger.log(Level.SEVERE, String.format("Error getting source content path for artifact (artifact_id=%d, obj_id=%d)", artifact.getArtifactID(), artifact.getObjectID()), ex);
path = Bundle.ArtifactStringContent_failedToGetSourcePath_message();
}
- buffer.append(path);
- buffer.append(" | "); //NON-NLS
- buffer.append("
\n"); //NON-NLS
+
+ buffer.append(makeTableRow(NbBundle.getMessage(this.getClass(), "ArtifactStringContent.getStr.srcFilePath.text"),
+ path, ""));
+
/*
* Add a row for the artifact id.
- */
- buffer.append(""); //NON-NLS
- buffer.append(NbBundle.getMessage(this.getClass(), "ArtifactStringContent.getStr.artifactId.text"));
- buffer.append(" | "); //NON-NLS
- buffer.append(artifact.getArtifactID());
- buffer.append(" | "); //NON-NLS
- buffer.append("
\n"); //NON-NLS
-
- /*
- * Finish the document
- */
- buffer.append("
"); //NON-NLS
- buffer.append("