Browse Source

StringUtils.replace is obsolete.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1453133 13f79535-47bb-0310-9956-ffa450edef68
master
Jesse N. Glick 12 years ago
parent
commit
aea016a70f
2 changed files with 3 additions and 10 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/util/DOMElementWriter.java
  2. +2
    -9
      src/main/org/apache/tools/ant/util/StringUtils.java

+ 1
- 1
src/main/org/apache/tools/ant/util/DOMElementWriter.java View File

@@ -498,7 +498,7 @@ public class DOMElementWriter {
} }
} }


return StringUtils.replace(sb.substring(0), "]]>", "]]]]><![CDATA[>");
return sb.substring(0).replace("]]>", "]]]]><![CDATA[>");
} }


/** /**


+ 2
- 9
src/main/org/apache/tools/ant/util/StringUtils.java View File

@@ -79,17 +79,10 @@ public final class StringUtils {
* @param from the occurrence to replace. * @param from the occurrence to replace.
* @param to the occurrence to be used as a replacement. * @param to the occurrence to be used as a replacement.
* @return the new string with replaced occurrences. * @return the new string with replaced occurrences.
* @deprecated Use {@link String#replace(CharSequence, CharSequence)} now.
*/ */
public static String replace(String data, String from, String to) { public static String replace(String data, String from, String to) {
StringBuffer buf = new StringBuffer(data.length());
int pos = -1;
int i = 0;
while ((pos = data.indexOf(from, i)) != -1) {
buf.append(data.substring(i, pos)).append(to);
i = pos + from.length();
}
buf.append(data.substring(i));
return buf.toString();
return data.replace(from, to);
} }


/** /**


Loading…
Cancel
Save