Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
Fix #166 by making last modified date comparison fuzzy
Browse files Browse the repository at this point in the history
  • Loading branch information
binwiederhier committed Jul 31, 2014
1 parent b9dfa95 commit ae3afda
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -290,12 +290,17 @@ private void compareSize(FileVersionComparison fileComparison) {
}

private void compareModifiedDate(FileVersionComparison fileComparison) {
if (fileComparison.expectedFileProperties.getLastModified() != fileComparison.actualFileProperties.getLastModified()) {
long timeDifferenceMillis = Math.abs(fileComparison.expectedFileProperties.getLastModified() - fileComparison.actualFileProperties.getLastModified());

// Fuzziness on last modified dates is necessary, see issue #166

if (timeDifferenceMillis > 1000) {
fileComparison.fileChanges.add(FileChange.CHANGED_LAST_MOD_DATE);

logger.log(Level.INFO, " - " + fileComparison.fileChanges
+ ": Local file DIFFERS from file version, expected MOD. DATE = {0}, but actual MOD. DATE = {1}, for file {2}", new Object[] {
new Date(fileComparison.expectedFileProperties.getLastModified()), new Date(fileComparison.actualFileProperties.getLastModified()),
+ ": Local file DIFFERS from file version, expected MOD. DATE = {0} ({1}), but actual MOD. DATE = {2} ({3}), for file {4}", new Object[] {
new Date(fileComparison.expectedFileProperties.getLastModified()), fileComparison.expectedFileProperties.getLastModified(),
new Date(fileComparison.actualFileProperties.getLastModified()), fileComparison.actualFileProperties.getLastModified(),
fileComparison.actualFileProperties.getRelativePath() });
}
}
Expand Down

0 comments on commit ae3afda

Please sign in to comment.