From 291e156566c20f5df81a99fb186b3ea83c28c313 Mon Sep 17 00:00:00 2001 From: William Schaefer <wschaefer@basistech.net> Date: Fri, 4 Aug 2017 15:45:36 -0400 Subject: [PATCH] 2885 Last Accessed time now sourced from last accessed attr instead of modified --- .../autoingest/AutoIngestCase.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestCase.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestCase.java index 6d37ca2a26..ff47423030 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestCase.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestCase.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2015 Basis Technology Corp. + * Copyright 2015-2017 Basis Technology Corp. * Contact: carrier <at> sleuthkit <dot> org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -39,7 +39,7 @@ class AutoIngestCase implements Comparable<AutoIngestCase> { private final String caseName; private final Path metadataFilePath; private final Date createDate; - private Date lastModfiedDate; + private final Date lastAccessedDate; /** * Constructs a representation of case created by automated ingest. @@ -58,10 +58,10 @@ class AutoIngestCase implements Comparable<AutoIngestCase> { } if (null != fileAttrs) { createDate = new Date(fileAttrs.creationTime().toMillis()); - lastModfiedDate = new Date(fileAttrs.lastModifiedTime().toMillis()); + lastAccessedDate = new Date(fileAttrs.lastAccessTime().toMillis()); } else { createDate = new Date(); - lastModfiedDate = new Date(); + lastAccessedDate = new Date(); } } @@ -94,19 +94,13 @@ Date getCreationDate() { } /** - * Gets the last accessed date for the case, defined as the last modified + * Gets the last accessed date for the case, defined as the last accessed * time of the case metadata file. * * @return The last accessed date. */ Date getLastAccessedDate() { - try { - BasicFileAttributes fileAttrs = Files.readAttributes(metadataFilePath, BasicFileAttributes.class); - lastModfiedDate = new Date(fileAttrs.lastModifiedTime().toMillis()); - } catch (IOException ex) { - logger.log(Level.SEVERE, String.format("Error reading file attributes of case metadata file in %s, lastModfiedDate time not updated", caseDirectoryPath), ex); - } - return lastModfiedDate; + return this.lastAccessedDate; } /** @@ -162,7 +156,7 @@ public int hashCode() { */ @Override public int compareTo(AutoIngestCase other) { - return -this.lastModfiedDate.compareTo(other.getLastAccessedDate()); + return -this.lastAccessedDate.compareTo(other.getLastAccessedDate()); } /** -- GitLab