ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 41411] New: - Bug in org.apache.tools.ant.types.resources.comparators.Date
Date Fri, 19 Jan 2007 14:08:30 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41411>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41411

           Summary: Bug in
                    org.apache.tools.ant.types.resources.comparators.Date
           Product: Ant
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: c_igaly@yahoo.co.uk


protected int resourceCompare(Resource foo, Resource bar) {
        return (int) (foo.getLastModified() - bar.getLastModified());
    }

When difference foo.getLastModified() - bar.getLastModified() is greater than
Integer.MAX_VALUE or less than Integer.MIN_VALUE, result returned by
resourceCompare is undefined. Possible fix is:

    protected int resourceCompare(Resource foo, Resource bar) {
        long diff = foo.getLastModified() - bar.getLastModified();
        if (diff > 0) {
            return +1;
        } else if (diff < 0) {
            return -1;
        } else {
            return 0;
        }
    }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message