ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r955506 - /ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.java
Date Thu, 17 Jun 2010 08:40:38 GMT
Author: bodewig
Date: Thu Jun 17 08:40:37 2010
New Revision: 955506

URL: http://svn.apache.org/viewvc?rev=955506&view=rev
Log:
Java 1.4

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/util/DOMElementWriter.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=955506&r1=955505&r2=955506&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 Thu Jun 17 08:40:37
2010
@@ -411,8 +411,8 @@ public class DOMElementWriter {
      * @return the encoded string.
      */
     public String encode(String value) {
-        StringBuffer sb = new StringBuffer();
         int len = value.length();
+        StringBuffer sb = new StringBuffer(len);
         for (int i = 0; i < len; i++) {
             char c = value.charAt(i);
             switch (c) {
@@ -458,8 +458,8 @@ public class DOMElementWriter {
 
      */
     public String encodedata(final String value) {
-        StringBuffer sb = new StringBuffer();
         int len = value.length();
+        StringBuffer sb = new StringBuffer(len);
         for (int i = 0; i < len; ++i) {
             char c = value.charAt(i);
             if (isLegalCharacter(c)) {
@@ -467,7 +467,7 @@ public class DOMElementWriter {
             }
         }
 
-        return sb.toString().replace("]]>", "]]]]><![CDATA[>");
+        return StringUtils.replace(sb.substring(0), "]]>", "]]]]><![CDATA[>");
     }
 
     /**



Mime
View raw message