diff --git a/common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java b/common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java index af65a6fe58d0fa4c2cd99dbc064b34b12d8264d9..51cdd4e42b3be348faa06271b15e5347b5075e67 100644 --- a/common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java +++ b/common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java @@ -493,10 +493,10 @@ public final class FileUtilities { if (referenceIsRelative) { - return reference > 0 && currentLastChanged >= System.currentTimeMillis() - reference; + return reference > 0 && currentLastChanged > System.currentTimeMillis() - reference; } else { - return reference > 0 && currentLastChanged >= reference; + return reference > 0 && currentLastChanged > reference; } } @@ -561,9 +561,9 @@ public final class FileUtilities * considering what this parameter is good for, note that the mtime of a directory is changed when an * entry in the directory changes. * @param stopWhenFindYounger If > 0, the recursive search for younger file will be stopped when a file or - * directory is found that is as young as or younger than the time specified in this parameter. Supposed - * to be used when one does not care about the absolute youngest entry, but only, if there are entries - * that are "young enough". + * directory is found that is younger than the time specified in this parameter. Supposed to be used when + * one does not care about the absolute youngest entry, but only, if there are entries that are "young + * enough". * @return The time when any file in (or below) <var>path</var> has last been changed in the file system. * @throws CheckedExceptionTunnel of an {@link IOException} if the <var>path</var> does not exist or is not * readable. @@ -585,7 +585,7 @@ public final class FileUtilities * considering what this parameter is good for, note that the mtime of a directory is changed when an * entry in the directory changes. * @param stopWhenFindYoungerRelative If > 0, the recursive search for younger file will be stopped when a file - * or directory is found that is as young as or younger than + * or directory is found that is younger than * <code>System.currentTimeMillis() - stopWhenYoungerRelative</code>. Supposed to be used when one * does not care about the absolute youngest entry, but only, if there are entries that are "young * enough". @@ -785,15 +785,15 @@ public final class FileUtilities "Failed to get listing of directory '%s' (path is file instead of directory).", directory)); } else { - logger.log(LogLevel.ERROR, String.format( - "Failed to get listing of directory '%s' (path not found).", directory)); + logger.log(LogLevel.ERROR, String.format("Failed to get listing of directory '%s' (path not found).", + directory)); } } else { StringWriter exStackWriter = new StringWriter(); exOrNull.printStackTrace(new PrintWriter(exStackWriter)); - logger.log(LogLevel.ERROR, String.format( - "Failed to get listing of directory '%s'. Exception: %s", directory, exStackWriter.toString())); + logger.log(LogLevel.ERROR, String.format("Failed to get listing of directory '%s'. Exception: %s", + directory, exStackWriter.toString())); } } diff --git a/common/sourceTest/java/ch/systemsx/cisd/common/utilities/FileUtilitiesLastChangedTest.java b/common/sourceTest/java/ch/systemsx/cisd/common/utilities/FileUtilitiesLastChangedTest.java index 4d11ece165f3463a0082b0250a49980518fb4d60..ac0742c593c8dfcb127ffb9b711def5ba47fd268 100644 --- a/common/sourceTest/java/ch/systemsx/cisd/common/utilities/FileUtilitiesLastChangedTest.java +++ b/common/sourceTest/java/ch/systemsx/cisd/common/utilities/FileUtilitiesLastChangedTest.java @@ -124,8 +124,8 @@ public class FileUtilitiesLastChangedTest dirA.setLastModified(1000L); assertEquals(3000L, FileUtilities.lastChanged(dirA, false, 0L)); assertEquals(2000L, FileUtilities.lastChanged(dirA, true, 0L)); - assertEquals(1000L, FileUtilities.lastChanged(dirA, false, 1000L)); - assertEquals(1000L, FileUtilities.lastChanged(dirA, true, 1000L)); + assertEquals(1000L, FileUtilities.lastChanged(dirA, false, 999L)); + assertEquals(1000L, FileUtilities.lastChanged(dirA, true, 999L)); } @Test