diff --git a/WHATSNEW b/WHATSNEW index f548d2f6b..4ba97742d 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -77,6 +77,10 @@ Fixed bugs: * Base64Converter not properly handling bytes with MSB set (not masking byte to int conversion) Bugzilla Report 54460 + * The size resource comparator would return wrong results if file + sizes differed by more than 2 GB. + Bugzilla Report 54623 + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/types/resources/comparators/Size.java b/src/main/org/apache/tools/ant/types/resources/comparators/Size.java index d608a96a2..b94f250b1 100644 --- a/src/main/org/apache/tools/ant/types/resources/comparators/Size.java +++ b/src/main/org/apache/tools/ant/types/resources/comparators/Size.java @@ -32,7 +32,8 @@ public class Size extends ResourceComparator { * argument is less than, equal to, or greater than the second. */ protected int resourceCompare(Resource foo, Resource bar) { - return (int) (foo.getSize() - bar.getSize()); + long diff = foo.getSize() - bar.getSize(); + return diff > 0 ? 1 : (diff == 0 ? 0 : -1); } }