diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2008-03-17 01:28:13 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2008-03-17 01:28:13 +0000 |
commit | f8f874a297ff06b4acecbbd87286b1eb4b08d064 (patch) | |
tree | 53e488bf7a7d6cbeedceeda0f54ab420faadb640 /gnu/xml | |
parent | de5e60dddb2e7298d7faa711e5d1a592d4d8de67 (diff) | |
download | classpath-f8f874a297ff06b4acecbbd87286b1eb4b08d064.tar.gz |
2008-03-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/xml/transform/AbstractNumberNode.java,
* gnu/xml/transform/ApplyTemplatesNode.java,
* gnu/xml/transform/AttributeNode.java,
* gnu/xml/transform/Bindings.java,
* gnu/xml/transform/CallTemplateNode.java,
* gnu/xml/transform/ChooseNode.java,
* gnu/xml/transform/CopyNode.java,
* gnu/xml/transform/CopyOfNode.java,
* gnu/xml/transform/ElementNode.java,
* gnu/xml/transform/ForEachNode.java,
* gnu/xml/transform/IfNode.java,
* gnu/xml/transform/MessageNode.java,
* gnu/xml/transform/ParameterNode.java,
* gnu/xml/transform/ProcessingInstructionNode.java,
* gnu/xml/transform/StreamSerializer.java,
* gnu/xml/transform/Template.java,
* gnu/xml/transform/TextNode.java,
* gnu/xml/transform/TransformerImpl.java,
* gnu/xml/transform/TransformerOutputProperties.java,
* gnu/xml/transform/ValueOfNode.java,
* gnu/xml/transform/WhenNode.java:
Use CPStringBuilder in preference to StringBuffer.
Diffstat (limited to 'gnu/xml')
21 files changed, 76 insertions, 34 deletions
diff --git a/gnu/xml/transform/AbstractNumberNode.java b/gnu/xml/transform/AbstractNumberNode.java index 6d1202e69..fb953e4f6 100644 --- a/gnu/xml/transform/AbstractNumberNode.java +++ b/gnu/xml/transform/AbstractNumberNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -140,7 +142,7 @@ abstract class AbstractNumberNode start = end; } // Process tokens - StringBuffer buf = new StringBuffer(); + CPStringBuilder buf = new CPStringBuilder(); len = tokens.size(); int pos = 0; for (int i = 0; i < len; i++) @@ -188,7 +190,7 @@ abstract class AbstractNumberNode return l; }*/ - void format(StringBuffer buf, int number, String formatToken) + void format(CPStringBuilder buf, int number, String formatToken) { int len = formatToken.length(); char c = formatToken.charAt(len - 1); @@ -254,7 +256,7 @@ abstract class AbstractNumberNode static final String alphabetic(char offset, int number) { - StringBuffer buf = new StringBuffer(); + CPStringBuilder buf = new CPStringBuilder(); while (number > 0) { int r = number % 26; @@ -269,7 +271,7 @@ abstract class AbstractNumberNode static final String roman(boolean upper, int number) { - StringBuffer buf = new StringBuffer(); + CPStringBuilder buf = new CPStringBuilder(); for (int pos = roman_numbers.length - 1; pos >= 0; pos -= 2) { int f = number / roman_numbers[pos]; @@ -317,7 +319,7 @@ abstract class AbstractNumberNode public String toString() { - StringBuffer buf = new StringBuffer("number"); + CPStringBuilder buf = new CPStringBuilder("number"); buf.append('['); buf.append("format="); buf.append(format); diff --git a/gnu/xml/transform/ApplyTemplatesNode.java b/gnu/xml/transform/ApplyTemplatesNode.java index 041809bdf..0daaa7aec 100644 --- a/gnu/xml/transform/ApplyTemplatesNode.java +++ b/gnu/xml/transform/ApplyTemplatesNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -192,7 +194,7 @@ final class ApplyTemplatesNode public String toString() { - StringBuffer buf = new StringBuffer("apply-templates"); + CPStringBuilder buf = new CPStringBuilder("apply-templates"); buf.append('['); boolean o = false; if (select != null) diff --git a/gnu/xml/transform/AttributeNode.java b/gnu/xml/transform/AttributeNode.java index 71e2ed0f7..bbc4e0805 100644 --- a/gnu/xml/transform/AttributeNode.java +++ b/gnu/xml/transform/AttributeNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import javax.xml.XMLConstants; import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; @@ -231,7 +233,7 @@ final class AttributeNode public String toString() { - StringBuffer buf = new StringBuffer("attribute"); + CPStringBuilder buf = new CPStringBuilder("attribute"); buf.append('['); buf.append("name="); buf.append(name); diff --git a/gnu/xml/transform/Bindings.java b/gnu/xml/transform/Bindings.java index 4ee083223..009321315 100644 --- a/gnu/xml/transform/Bindings.java +++ b/gnu/xml/transform/Bindings.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -259,7 +261,7 @@ public class Bindings public String toString() { - StringBuffer buf = new StringBuffer(); + CPStringBuilder buf = new CPStringBuilder(); boolean next = false; Collection seen = new HashSet(); Map wctx = (Map) withParameters.getFirst(); diff --git a/gnu/xml/transform/CallTemplateNode.java b/gnu/xml/transform/CallTemplateNode.java index 31b26cbcd..a85fba9d9 100644 --- a/gnu/xml/transform/CallTemplateNode.java +++ b/gnu/xml/transform/CallTemplateNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; @@ -146,7 +148,7 @@ final class CallTemplateNode public String toString() { - StringBuffer buf = new StringBuffer("call-template"); + CPStringBuilder buf = new CPStringBuilder("call-template"); buf.append('['); buf.append("name="); buf.append(name); diff --git a/gnu/xml/transform/ChooseNode.java b/gnu/xml/transform/ChooseNode.java index cf07fa54b..fe2dc0c2f 100644 --- a/gnu/xml/transform/ChooseNode.java +++ b/gnu/xml/transform/ChooseNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; import org.w3c.dom.Node; @@ -77,7 +79,7 @@ final class ChooseNode public String toString() { - StringBuffer buf = new StringBuffer("choose"); + CPStringBuilder buf = new CPStringBuilder("choose"); buf.append('['); buf.append(']'); return buf.toString(); diff --git a/gnu/xml/transform/CopyNode.java b/gnu/xml/transform/CopyNode.java index 64cfa5191..bae628d96 100644 --- a/gnu/xml/transform/CopyNode.java +++ b/gnu/xml/transform/CopyNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.util.Iterator; import java.util.StringTokenizer; import javax.xml.namespace.QName; @@ -152,7 +154,7 @@ final class CopyNode public String toString() { - StringBuffer buf = new StringBuffer("copy"); + CPStringBuilder buf = new CPStringBuilder("copy"); if (uas != null) { buf.append('['); diff --git a/gnu/xml/transform/CopyOfNode.java b/gnu/xml/transform/CopyOfNode.java index ed4358c90..4ce84329f 100644 --- a/gnu/xml/transform/CopyOfNode.java +++ b/gnu/xml/transform/CopyOfNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -161,7 +163,7 @@ final class CopyOfNode public String toString() { - StringBuffer buf = new StringBuffer("copy-of"); + CPStringBuilder buf = new CPStringBuilder("copy-of"); buf.append('['); buf.append("select="); buf.append(select); diff --git a/gnu/xml/transform/ElementNode.java b/gnu/xml/transform/ElementNode.java index b6a5c365b..c5a4dd20d 100644 --- a/gnu/xml/transform/ElementNode.java +++ b/gnu/xml/transform/ElementNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.util.Collection; import java.util.Collections; import java.util.HashSet; @@ -238,7 +240,7 @@ final class ElementNode public String toString() { - StringBuffer buf = new StringBuffer("element"); + CPStringBuilder buf = new CPStringBuilder("element"); buf.append('['); buf.append("name="); if (namespace != null) diff --git a/gnu/xml/transform/ForEachNode.java b/gnu/xml/transform/ForEachNode.java index 25b824534..e2aed74b4 100644 --- a/gnu/xml/transform/ForEachNode.java +++ b/gnu/xml/transform/ForEachNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -146,7 +148,7 @@ final class ForEachNode public String toString() { - StringBuffer buf = new StringBuffer("for-each"); + CPStringBuilder buf = new CPStringBuilder("for-each"); buf.append('['); buf.append("select="); buf.append(select); diff --git a/gnu/xml/transform/IfNode.java b/gnu/xml/transform/IfNode.java index 2a00d64ca..eeb294138 100644 --- a/gnu/xml/transform/IfNode.java +++ b/gnu/xml/transform/IfNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; import org.w3c.dom.Node; @@ -99,7 +101,7 @@ final class IfNode public String toString() { - StringBuffer buf = new StringBuffer("if"); + CPStringBuilder buf = new CPStringBuilder("if"); buf.append('['); buf.append("test="); buf.append(test); diff --git a/gnu/xml/transform/MessageNode.java b/gnu/xml/transform/MessageNode.java index 890d76f6b..a7eeeeef6 100644 --- a/gnu/xml/transform/MessageNode.java +++ b/gnu/xml/transform/MessageNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.util.logging.Logger; import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; @@ -95,7 +97,7 @@ final class MessageNode public String toString() { - StringBuffer buf = new StringBuffer("message"); + CPStringBuilder buf = new CPStringBuilder("message"); if (terminate) { buf.append('['); diff --git a/gnu/xml/transform/ParameterNode.java b/gnu/xml/transform/ParameterNode.java index 8cd2677cf..5feaf3225 100644 --- a/gnu/xml/transform/ParameterNode.java +++ b/gnu/xml/transform/ParameterNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.util.Collections; import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; @@ -148,7 +150,7 @@ final class ParameterNode public String toString() { - StringBuffer buf = new StringBuffer(); + CPStringBuilder buf = new CPStringBuilder(); switch (type) { case Bindings.VARIABLE: diff --git a/gnu/xml/transform/ProcessingInstructionNode.java b/gnu/xml/transform/ProcessingInstructionNode.java index bf61fc038..655f51f01 100644 --- a/gnu/xml/transform/ProcessingInstructionNode.java +++ b/gnu/xml/transform/ProcessingInstructionNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; import org.w3c.dom.Document; @@ -105,7 +107,7 @@ final class ProcessingInstructionNode public String toString() { - StringBuffer buf = new StringBuffer("processing-instruction"); + CPStringBuilder buf = new CPStringBuilder("processing-instruction"); buf.append('['); buf.append("name="); buf.append(name); diff --git a/gnu/xml/transform/StreamSerializer.java b/gnu/xml/transform/StreamSerializer.java index 35323e735..289967218 100644 --- a/gnu/xml/transform/StreamSerializer.java +++ b/gnu/xml/transform/StreamSerializer.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; @@ -595,7 +597,7 @@ public class StreamSerializer if (!encoder.canEncode(text) || htmlNeedingEncoding) { // Check each character - StringBuffer buf = new StringBuffer(); + CPStringBuilder buf = new CPStringBuilder(); int len = text.length(); for (int i = 0; i < len; i++) { @@ -648,20 +650,20 @@ public class StreamSerializer String encode(String text, boolean encodeCtl, boolean inAttr) { int len = text.length(); - StringBuffer buf = null; + CPStringBuilder buf = null; for (int i = 0; i < len; i++) { char c = text.charAt(i); if (c == '<') { if (buf == null) - buf = new StringBuffer(text.substring(0, i)); + buf = new CPStringBuilder(text.substring(0, i)); buf.append("<"); } else if (c == '>') { if (buf == null) - buf = new StringBuffer(text.substring(0, i)); + buf = new CPStringBuilder(text.substring(0, i)); buf.append(">"); } else if (c == '&') @@ -675,14 +677,14 @@ public class StreamSerializer else { if (buf == null) - buf = new StringBuffer(text.substring(0, i)); + buf = new CPStringBuilder(text.substring(0, i)); buf.append("&"); } } else if (c == '\'' && inAttr) { if (buf == null) - buf = new StringBuffer(text.substring(0, i)); + buf = new CPStringBuilder(text.substring(0, i)); if (mode == Stylesheet.OUTPUT_HTML) // HTML does not define ', use character entity ref buf.append("'"); @@ -692,7 +694,7 @@ public class StreamSerializer else if (c == '"' && inAttr) { if (buf == null) - buf = new StringBuffer(text.substring(0, i)); + buf = new CPStringBuilder(text.substring(0, i)); buf.append("""); } else if (encodeCtl) @@ -700,7 +702,7 @@ public class StreamSerializer if (c < 0x20) { if (buf == null) - buf = new StringBuffer(text.substring(0, i)); + buf = new CPStringBuilder(text.substring(0, i)); buf.append('&'); buf.append('#'); buf.append((int) c); diff --git a/gnu/xml/transform/Template.java b/gnu/xml/transform/Template.java index 1414dac9e..c45cc8849 100644 --- a/gnu/xml/transform/Template.java +++ b/gnu/xml/transform/Template.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.io.PrintStream; import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; @@ -226,7 +228,7 @@ class Template public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); + CPStringBuilder buf = new CPStringBuilder(getClass().getName()); buf.append('['); if (name != null) { diff --git a/gnu/xml/transform/TextNode.java b/gnu/xml/transform/TextNode.java index 39423b270..93d1d5417 100644 --- a/gnu/xml/transform/TextNode.java +++ b/gnu/xml/transform/TextNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; import org.w3c.dom.Document; @@ -106,7 +108,7 @@ final class TextNode public String toString() { - StringBuffer buf = new StringBuffer("text"); + CPStringBuilder buf = new CPStringBuilder("text"); if (disableOutputEscaping) { buf.append('['); diff --git a/gnu/xml/transform/TransformerImpl.java b/gnu/xml/transform/TransformerImpl.java index f43b6602f..a975c691f 100644 --- a/gnu/xml/transform/TransformerImpl.java +++ b/gnu/xml/transform/TransformerImpl.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException; @@ -722,7 +724,7 @@ class TransformerImpl } else { - StringBuffer buf = new StringBuffer(); + CPStringBuilder buf = new CPStringBuilder(); buf.append('\n'); for (int i = 0; i < offset + 1; i++) buf.append(INDENT_WHITESPACE); @@ -733,7 +735,7 @@ class TransformerImpl node.insertBefore(doc.createTextNode(ws), ctx); reindent(doc, ctx, offset + 1); } - buf = new StringBuffer(); + buf = new CPStringBuilder(); buf.append('\n'); for (int i = 0; i < offset; i++) buf.append(INDENT_WHITESPACE); diff --git a/gnu/xml/transform/TransformerOutputProperties.java b/gnu/xml/transform/TransformerOutputProperties.java index cc8593c46..9ac5cdc04 100644 --- a/gnu/xml/transform/TransformerOutputProperties.java +++ b/gnu/xml/transform/TransformerOutputProperties.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.util.Collection; import java.util.Iterator; import java.util.LinkedHashSet; @@ -95,7 +97,7 @@ class TransformerOutputProperties defaultProperties.put(OutputKeys.DOCTYPE_SYSTEM, stylesheet.outputSystemId); } - StringBuffer buf = new StringBuffer(); + CPStringBuilder buf = new CPStringBuilder(); for (Iterator i = stylesheet.outputCdataSectionElements.iterator(); i.hasNext(); ) { diff --git a/gnu/xml/transform/ValueOfNode.java b/gnu/xml/transform/ValueOfNode.java index 68f31e05a..ca9383684 100644 --- a/gnu/xml/transform/ValueOfNode.java +++ b/gnu/xml/transform/ValueOfNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import java.util.Collection; import java.util.Iterator; import javax.xml.namespace.QName; @@ -84,7 +86,7 @@ final class ValueOfNode String value; if (ret instanceof Collection) { - StringBuffer buf = new StringBuffer(); + CPStringBuilder buf = new CPStringBuilder(); for (Iterator i = ((Collection) ret).iterator(); i.hasNext(); ) { Node node = (Node) i.next(); @@ -126,7 +128,7 @@ final class ValueOfNode public String toString() { - StringBuffer buf = new StringBuffer("value-of"); + CPStringBuilder buf = new CPStringBuilder("value-of"); buf.append('['); buf.append("select="); buf.append(select); diff --git a/gnu/xml/transform/WhenNode.java b/gnu/xml/transform/WhenNode.java index fe3f403ab..fc9d5b187 100644 --- a/gnu/xml/transform/WhenNode.java +++ b/gnu/xml/transform/WhenNode.java @@ -37,6 +37,8 @@ exception statement from your version. */ package gnu.xml.transform; +import gnu.java.lang.CPStringBuilder; + import javax.xml.namespace.QName; import javax.xml.transform.TransformerException; import org.w3c.dom.Node; @@ -102,7 +104,7 @@ final class WhenNode public String toString() { - StringBuffer buf = new StringBuffer("when"); + CPStringBuilder buf = new CPStringBuilder("when"); buf.append('['); buf.append("test="); buf.append(test); |