2885 Last Accessed time now sourced from last accessed attr instead of modified

This commit is contained in:
William Schaefer 2017-08-04 15:45:36 -04:00
parent 93ed39fe79
commit 291e156566

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2015 Basis Technology Corp. * Copyright 2015-2017 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * 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 String caseName;
private final Path metadataFilePath; private final Path metadataFilePath;
private final Date createDate; private final Date createDate;
private Date lastModfiedDate; private final Date lastAccessedDate;
/** /**
* Constructs a representation of case created by automated ingest. * Constructs a representation of case created by automated ingest.
@ -58,10 +58,10 @@ class AutoIngestCase implements Comparable<AutoIngestCase> {
} }
if (null != fileAttrs) { if (null != fileAttrs) {
createDate = new Date(fileAttrs.creationTime().toMillis()); createDate = new Date(fileAttrs.creationTime().toMillis());
lastModfiedDate = new Date(fileAttrs.lastModifiedTime().toMillis()); lastAccessedDate = new Date(fileAttrs.lastAccessTime().toMillis());
} else { } else {
createDate = new Date(); createDate = new Date();
lastModfiedDate = new Date(); lastAccessedDate = new Date();
} }
} }
@ -94,19 +94,13 @@ class AutoIngestCase implements Comparable<AutoIngestCase> {
} }
/** /**
* 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. * time of the case metadata file.
* *
* @return The last accessed date. * @return The last accessed date.
*/ */
Date getLastAccessedDate() { Date getLastAccessedDate() {
try { return this.lastAccessedDate;
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;
} }
/** /**
@ -162,7 +156,7 @@ class AutoIngestCase implements Comparable<AutoIngestCase> {
*/ */
@Override @Override
public int compareTo(AutoIngestCase other) { public int compareTo(AutoIngestCase other) {
return -this.lastModfiedDate.compareTo(other.getLastAccessedDate()); return -this.lastAccessedDate.compareTo(other.getLastAccessedDate());
} }
/** /**