ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgl...@apache.org
Subject svn commit: r1453133 - in /ant/core/trunk/src/main/org/apache/tools/ant/util: DOMElementWriter.java StringUtils.java
Date Wed, 06 Mar 2013 02:03:52 GMT
Author: jglick
Date: Wed Mar  6 02:03:52 2013
New Revision: 1453133

URL: http://svn.apache.org/r1453133
Log:
StringUtils.replace is obsolete.

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/StringUtils.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java?rev=1453133&r1=1453132&r2=1453133&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java Wed Mar  6 02:03:52
2013
@@ -498,7 +498,7 @@ public class DOMElementWriter {
             }
         }
 
-        return StringUtils.replace(sb.substring(0), "]]>", "]]]]><![CDATA[>");
+        return sb.substring(0).replace("]]>", "]]]]><![CDATA[>");
     }
 
     /**

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/StringUtils.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/StringUtils.java?rev=1453133&r1=1453132&r2=1453133&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/StringUtils.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/StringUtils.java Wed Mar  6 02:03:52
2013
@@ -79,17 +79,10 @@ public final class StringUtils {
      * @param from the occurrence to replace.
      * @param to the occurrence to be used as a replacement.
      * @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) {
-        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);
     }
 
     /**



Mime
View raw message