From 4dbe4dd92b5ec3dad9b357bffba330ad79d3895b Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Wed, 29 Oct 2008 17:05:23 +0000 Subject: [PATCH] simplify(?); use constants git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@708942 13f79535-47bb-0310-9956-ffa450edef68 --- .../ant/types/selectors/SelectorUtils.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java b/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java index e31caaeb6..8aabc0d9c 100644 --- a/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java +++ b/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java @@ -24,7 +24,6 @@ import java.util.Vector; import org.apache.tools.ant.types.Resource; import org.apache.tools.ant.util.FileUtils; -import org.apache.tools.ant.types.resources.FileResource; /** *

This is a utility class used by selectors and DirectoryScanner. The @@ -647,20 +646,13 @@ public final class SelectorUtils { * determining out of dateness * @return whether the target is out of date */ - public static boolean isOutOfDate(Resource src, Resource target, - long granularity) { + public static boolean isOutOfDate(Resource src, Resource target, long granularity) { long sourceLastModified = src.getLastModified(); - // Check if source exists - use sourceLastModified for file resources - // as it is quicker than checking exists() again, however string resources - // have a last modified time of 0 - boolean sourceExists = (src instanceof FileResource) - ? sourceLastModified != 0L : src.isExists(); - long targetLastModified = target.getLastModified(); - if (targetLastModified == 0L) { - return true; - } - return (sourceLastModified - granularity) > targetLastModified; + return src.isExists() + && (sourceLastModified == Resource.UNKNOWN_DATETIME + || targetLastModified == Resource.UNKNOWN_DATETIME + || (sourceLastModified - granularity) > targetLastModified); } /**