diff options
author | Gintas Grigelionis <gintas@apache.org> | 2018-04-01 21:39:10 +0200 |
---|---|---|
committer | Gintas Grigelionis <gintas@apache.org> | 2018-04-01 21:39:10 +0200 |
commit | 86c7b1ff732b6a40f1f9bb2b9d75c70f027031fa (patch) | |
tree | 4ed600699d38d7ed19a3bba4ec52b98f408f80a3 /src/main/org/apache/tools | |
parent | 95495d57aa5cca8fc350ebfb10f6d390f40290cb (diff) | |
download | ant-86c7b1ff732b6a40f1f9bb2b9d75c70f027031fa.tar.gz |
Simplify append substring
Diffstat (limited to 'src/main/org/apache/tools')
6 files changed, 6 insertions, 6 deletions
diff --git a/src/main/org/apache/tools/ant/DefaultLogger.java b/src/main/org/apache/tools/ant/DefaultLogger.java index 8390a646e..db3cb686f 100644 --- a/src/main/org/apache/tools/ant/DefaultLogger.java +++ b/src/main/org/apache/tools/ant/DefaultLogger.java @@ -140,7 +140,7 @@ public class DefaultLogger implements BuildLogger { String msg1 = error.toString(); String msg2 = cause.toString(); if (msg1.endsWith(msg2)) { - m.append(msg1.substring(0, msg1.length() - msg2.length())); + m.append(msg1, 0, msg1.length() - msg2.length()); error = cause; } else { break; diff --git a/src/main/org/apache/tools/ant/filters/TokenFilter.java b/src/main/org/apache/tools/ant/filters/TokenFilter.java index 7da00cd60..e749836b0 100644 --- a/src/main/org/apache/tools/ant/filters/TokenFilter.java +++ b/src/main/org/apache/tools/ant/filters/TokenFilter.java @@ -380,7 +380,7 @@ public class TokenFilter extends BaseFilterReader while (found >= 0) { // write everything up to the from if (found > start) { - ret.append(line.substring(start, found)); + ret.append(line, start, found); } // write the replacement to diff --git a/src/main/org/apache/tools/ant/taskdefs/KeySubst.java b/src/main/org/apache/tools/ant/taskdefs/KeySubst.java index ee476e7c6..44ea5303b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/KeySubst.java +++ b/src/main/org/apache/tools/ant/taskdefs/KeySubst.java @@ -177,7 +177,7 @@ public class KeySubst extends Task { while ((index = origString.indexOf("${", i)) > -1) { key = origString.substring(index + 2, origString.indexOf("}", index + 3)); - finalString.append(origString.substring(i, index)); + finalString.append(origString, i, index); if (keys.containsKey(key)) { finalString.append(keys.get(key)); } else { diff --git a/src/main/org/apache/tools/ant/types/FilterSet.java b/src/main/org/apache/tools/ant/types/FilterSet.java index 38bc5cc9c..67dc16e8c 100644 --- a/src/main/org/apache/tools/ant/types/FilterSet.java +++ b/src/main/org/apache/tools/ant/types/FilterSet.java @@ -536,7 +536,7 @@ public class FilterSet extends DataType implements Cloneable { } String token = line.substring(index + beginToken.length(), endIndex); - b.append(line.substring(i, index)); + b.append(line, i, index); if (tokens.containsKey(token)) { String value = tokens.get(token); if (recurse && !value.equals(token)) { diff --git a/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java b/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java index dafda3e0b..6dcb3aa57 100644 --- a/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java +++ b/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java @@ -554,7 +554,7 @@ public class LayoutPreservingProperties extends Properties { } final int p = forEscaping.indexOf(c); if (p != -1) { - buffy.append("\\").append(escaped.substring(p, p + 1)); + buffy.append("\\").append(escaped, p, p + 1); } else if (c < 0x0020 || c > 0x007e) { buffy.append(escapeUnicode(c)); } else { diff --git a/src/main/org/apache/tools/mail/SmtpResponseReader.java b/src/main/org/apache/tools/mail/SmtpResponseReader.java index 69b11b4cc..2fdddc8a4 100644 --- a/src/main/org/apache/tools/mail/SmtpResponseReader.java +++ b/src/main/org/apache/tools/mail/SmtpResponseReader.java @@ -57,7 +57,7 @@ public class SmtpResponseReader { String line = reader.readLine(); // CheckStyle:MagicNumber OFF if (line != null && line.length() >= 3) { - result.append(line.substring(0, 3)); + result.append(line, 0, 3); result.append(" "); } // CheckStyle:MagicNumber ON |