summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bodewig <bodewig@apache.org>2023-04-03 12:36:33 +0200
committerStefan Bodewig <bodewig@apache.org>2023-04-03 12:39:14 +0200
commitd29f62fcc2d263878c1b53fc10d9bd4b9dbc8377 (patch)
tree210244d74548871d0001e3aeecc5cf68747fcc85
parentec02ae2c3df7ea40d8099ab1da35e1c9d3b3533f (diff)
downloadant-d29f62fcc2d263878c1b53fc10d9bd4b9dbc8377.tar.gz
really compare the names as the javadocs claim
https://bz.apache.org/bugzilla/show_bug.cgi?id=66496
-rw-r--r--WHATSNEW7
-rw-r--r--src/main/org/apache/tools/ant/types/Resource.java2
2 files changed, 8 insertions, 1 deletions
diff --git a/WHATSNEW b/WHATSNEW
index 267b0d549..7c80e8926 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -1,6 +1,13 @@
Changes from Ant 1.10.13 TO Ant 1.10.14
=======================================
+Changes that could break older environments:
+-------------------------------------------
+
+ * Resource#compareTo now invokes getName rather than toString as the
+ later may be costly (for example in the case of a StringResource).
+ Bugzilla Report 66496
+
Fixed bugs:
-----------
diff --git a/src/main/org/apache/tools/ant/types/Resource.java b/src/main/org/apache/tools/ant/types/Resource.java
index 12563d426..954757f25 100644
--- a/src/main/org/apache/tools/ant/types/Resource.java
+++ b/src/main/org/apache/tools/ant/types/Resource.java
@@ -277,7 +277,7 @@ public class Resource extends DataType implements Comparable<Resource>, Resource
if (isReference()) {
return getRef().compareTo(other);
}
- return toString().compareTo(other.toString());
+ return getName().compareTo(other.getName());
}
/**