You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2008/03/08 00:35:28 UTC
DO NOT REPLY [Bug 44565] New: Date Resource comparator returns
incorrect results breaking DependSet
https://issues.apache.org/bugzilla/show_bug.cgi?id=44565
Summary: Date Resource comparator returns incorrect results
breaking DependSet
Product: Ant
Version: 1.7.0
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Core tasks
AssignedTo: notifications@ant.apache.org
ReportedBy: wayne@lewisclan.org
The class org.apache.tools.ant.types.resources.comparators.Date compares the
dates
of two resources. This is used by tasks such as DependSet.
Line 35 in version 1.7.0 is shown below:
return (int) (foo.getLastModified() - bar.getLastModified());
This subtracts two longs and truncates the result to an int. This doesn't work
when the difference between the modification dates reach 2^31 ms which is about
25 days. The result is unpredictable behavior by all code that sorts using
this comparator.
A working alternative is:
long d = foo.getLastModified() - bar.getLastModified();
return ( d < 0 ) ? -1 : ( d > 0 ) ? +1 : 0;
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 44565] Date Resource comparator returns incorrect
results breaking DependSet
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44565
Matt Benson <gu...@yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
--- Comment #1 from Matt Benson <gu...@yahoo.com> 2008-03-07 15:42:26 PST ---
Sorry, dude... this should be fixed in the really-soon-now release of Ant
1.7.1.
*** This bug has been marked as a duplicate of bug 41411 ***
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.