Skip to content
Snippets Groups Projects
Commit 291e1565 authored by William Schaefer's avatar William Schaefer
Browse files

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

parent 93ed39fe
No related branches found
No related tags found
No related merge requests found
/*
* 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());
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment