Skip to content

Commit

Permalink
'#2231 Avoid repetitive string parsing and exposes class field to test
Browse files Browse the repository at this point in the history
unit.
  • Loading branch information
patrickdalla committed May 24, 2024
1 parent b1dcda0 commit e6392a0
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public enum ReportType {
public static final MediaType USNJRNL_REPORT_CSV = MediaType.parse("application/x-usnjournal-report-csv");
public static final MediaType USNJRNL_REGISTRY = MediaType.parse("application/x-usnjournal-registry");

private static final String USN_REASON_PREFIX = "ntfs_usn_reason";
static final String USN_REASON_PREFIX = "ntfs_usn_reason";

private static Set<MediaType> SUPPORTED_TYPES = MediaType.set(USNJRNL_$J);

Expand Down Expand Up @@ -188,9 +188,10 @@ private void createReport(ArrayList<UsnJrnlEntry> entries, int n, ParseContext c
metadataItem.set(props[1], entry.getFileName());
metadataItem.set(props[2], entry.getFullPath());
metadataItem.set(props[3], Long.toString(entry.getUSN()));
String formatedDate = rg.timeFormat.format(entry.getFileTime());
for (String value : entry.getReasons()) {
MetadataUtil.setMetadataType(USN_REASON_PREFIX + ":" + value, Date.class);
metadataItem.set(USN_REASON_PREFIX + ":" + value, rg.timeFormat.format(entry.getFileTime()));
metadataItem.set(USN_REASON_PREFIX + ":" + value, formatedDate);
metadataItem.add(props[5], value);
}
metadataItem.set(props[6], "0x" + Util.byteArrayToHex(entry.getMftRef()));
Expand Down

0 comments on commit e6392a0

Please sign in to comment.