diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java index 1ad6277e3..b745f2afd 100644 --- a/src/main/org/apache/tools/ant/Main.java +++ b/src/main/org/apache/tools/ant/Main.java @@ -1284,9 +1284,9 @@ public class Main implements AntMain { // now, start printing the targets and their descriptions final String lSep = System.getProperty("line.separator"); // got a bit annoyed that I couldn't find a pad function - String spaces = " "; + StringBuilder spaces = new StringBuilder(" "); while (spaces.length() <= maxlen) { - spaces += spaces; + spaces.append(spaces); } final StringBuilder msg = new StringBuilder(); msg.append(heading).append(lSep).append(lSep); diff --git a/src/main/org/apache/tools/ant/filters/ReplaceTokens.java b/src/main/org/apache/tools/ant/filters/ReplaceTokens.java index 74da64a16..bcbc312cd 100644 --- a/src/main/org/apache/tools/ant/filters/ReplaceTokens.java +++ b/src/main/org/apache/tools/ant/filters/ReplaceTokens.java @@ -23,6 +23,7 @@ import java.io.InputStream; import java.io.Reader; import java.util.Enumeration; import java.util.Hashtable; +import java.util.Map; import java.util.Properties; import java.util.SortedMap; import java.util.TreeMap; @@ -116,8 +117,8 @@ public final class ReplaceTokens if (!resolvedTokensBuilt) { // build the resolved tokens tree map. - for (String key : hash.keySet()) { - resolvedTokens.put(beginToken + key + endToken, hash.get(key)); + for (Map.Entry entry : hash.entrySet()) { + resolvedTokens.put(beginToken + entry.getKey() + endToken, entry.getValue()); } resolvedTokensBuilt = true; }