From 9a388391c48374a012528caf6edb0c5ce5b282a5 Mon Sep 17 00:00:00 2001 From: Jacobus Martinus Kruithof Date: Sat, 27 Jan 2007 21:09:30 +0000 Subject: [PATCH] 41411 Bug in org.apache.tools.ant.types.resources.comparators.Date Cedomir Igaly git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@500620 13f79535-47bb-0310-9956-ffa450edef68 --- CONTRIBUTORS | 1 + WHATSNEW | 2 ++ .../tools/ant/types/resources/comparators/Date.java | 9 ++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 355188c4d..adcacf0ee 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -29,6 +29,7 @@ Brant Langer Gurganus Brian Deitte Brian Felder Bruce Atherton +Cedomir Igaly Charles Hudak Charlie Hubbard Chris Povirk diff --git a/WHATSNEW b/WHATSNEW index 629d42eb8..6372c2dfa 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -6,6 +6,8 @@ Changes that could break older environments: Fixed bugs: ----------- +* Bug in org.apache.tools.ant.types.resources.comparators.Date + Bugzilla report 41411 * in Ant 1.7.0 could throw NPE if no was defined. Bugzilla report 41422. diff --git a/src/main/org/apache/tools/ant/types/resources/comparators/Date.java b/src/main/org/apache/tools/ant/types/resources/comparators/Date.java index 7638a181c..b6be66bb6 100755 --- a/src/main/org/apache/tools/ant/types/resources/comparators/Date.java +++ b/src/main/org/apache/tools/ant/types/resources/comparators/Date.java @@ -32,7 +32,14 @@ public class Date extends ResourceComparator { * argument is less than, equal to, or greater than the second. */ protected int resourceCompare(Resource foo, Resource bar) { - return (int) (foo.getLastModified() - bar.getLastModified()); + long diff = foo.getLastModified() - bar.getLastModified(); + if (diff > 0) { + return +1; + } else if (diff < 0) { + return -1; + } else { + return 0; + } } }