ChangeLog: 2008-05-06 Andrew John Hughes <[EMAIL PROTECTED]>
PR classpath/21869 * gnu/xml/stream/XMLEventImpl.java, * gnu/xml/stream/XMLParser.java, * gnu/xml/validation/datatype/EntitiesType.java, * gnu/xml/validation/datatype/NMTokensType.java: Swap use of StringBuffer for CPStringBuilder, -- Andrew :) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint = F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8
Index: gnu/xml/stream/XMLEventImpl.java =================================================================== RCS file: /sources/classpath/classpath/gnu/xml/stream/XMLEventImpl.java,v retrieving revision 1.3 diff -u -r1.3 XMLEventImpl.java --- gnu/xml/stream/XMLEventImpl.java 18 Sep 2007 21:52:32 -0000 1.3 +++ gnu/xml/stream/XMLEventImpl.java 6 May 2008 01:03:48 -0000 @@ -37,6 +37,8 @@ package gnu.xml.stream; +import gnu.java.lang.CPStringBuilder; + import java.io.Writer; import javax.xml.namespace.QName; import javax.xml.stream.Location; @@ -141,7 +143,7 @@ protected String encode(String text, boolean inAttr) { int len = text.length(); - StringBuffer buf = null; + CPStringBuilder buf = null; for (int i = 0; i < len; i++) { char c = text.charAt(i); @@ -149,7 +151,7 @@ { if (buf == null) { - buf = new StringBuffer(text.substring(0, i)); + buf = new CPStringBuilder(text.substring(0, i)); } buf.append("<"); } @@ -157,7 +159,7 @@ { if (buf == null) { - buf = new StringBuffer(text.substring(0, i)); + buf = new CPStringBuilder(text.substring(0, i)); } buf.append(">"); } @@ -165,7 +167,7 @@ { if (buf == null) { - buf = new StringBuffer(text.substring(0, i)); + buf = new CPStringBuilder(text.substring(0, i)); } buf.append("&"); } @@ -173,7 +175,7 @@ { if (buf == null) { - buf = new StringBuffer(text.substring(0, i)); + buf = new CPStringBuilder(text.substring(0, i)); } buf.append("'"); } @@ -181,7 +183,7 @@ { if (buf == null) { - buf = new StringBuffer(text.substring(0, i)); + buf = new CPStringBuilder(text.substring(0, i)); } buf.append("""); } Index: gnu/xml/stream/XMLParser.java =================================================================== RCS file: /sources/classpath/classpath/gnu/xml/stream/XMLParser.java,v retrieving revision 1.34 diff -u -r1.34 XMLParser.java --- gnu/xml/stream/XMLParser.java 28 Jul 2007 15:38:14 -0000 1.34 +++ gnu/xml/stream/XMLParser.java 6 May 2008 01:03:51 -0000 @@ -53,6 +53,8 @@ package gnu.xml.stream; +import gnu.java.lang.CPStringBuilder; + import java.io.BufferedInputStream; import java.io.EOFException; import java.io.File; @@ -691,7 +693,7 @@ { if (event != XMLStreamConstants.START_ELEMENT) throw new XMLStreamException("current event must be START_ELEMENT"); - StringBuffer elementText = new StringBuffer(); + CPStringBuilder elementText = new CPStringBuilder(); int depth = stack.size(); while (event != XMLStreamConstants.END_ELEMENT || stack.size() > depth) { @@ -2011,7 +2013,7 @@ else { ContentModel model; - StringBuffer acc = new StringBuffer(); + CPStringBuilder acc = new CPStringBuilder(); require('('); acc.append('('); skipWhitespace(); @@ -2058,7 +2060,7 @@ /** * Parses an element content model. */ - private ElementContentModel readElements(StringBuffer acc) + private ElementContentModel readElements(CPStringBuilder acc) throws IOException, XMLStreamException { int separator; @@ -2159,7 +2161,7 @@ /** * Parse a cp production. */ - private ContentParticle readContentParticle(StringBuffer acc) + private ContentParticle readContentParticle(CPStringBuilder acc) throws IOException, XMLStreamException { ContentParticle cp = new ContentParticle(); @@ -2228,7 +2230,7 @@ { String name = readNmtoken(true); requireWhitespace(); - StringBuffer acc = new StringBuffer(); + CPStringBuilder acc = new CPStringBuilder(); HashSet values = new HashSet(); String type = readAttType(acc, values); if (validating) @@ -2277,7 +2279,7 @@ /** * Parse an attribute type. */ - private String readAttType(StringBuffer acc, HashSet values) + private String readAttType(CPStringBuilder acc, HashSet values) throws IOException, XMLStreamException { if (tryRead('(')) @@ -2313,7 +2315,7 @@ /** * Parse an enumeration. */ - private void readEnumeration(boolean isNames, StringBuffer acc, + private void readEnumeration(boolean isNames, CPStringBuilder acc, HashSet values) throws IOException, XMLStreamException { @@ -2344,7 +2346,7 @@ /** * Parse a notation type for an attribute. */ - private void readNotationType(StringBuffer acc, HashSet values) + private void readNotationType(CPStringBuilder acc, HashSet values) throws IOException, XMLStreamException { requireWhitespace(); @@ -3518,7 +3520,7 @@ private char[] readCharacterRef(int base) throws IOException, XMLStreamException { - StringBuffer b = new StringBuffer(); + CPStringBuilder b = new CPStringBuilder(); for (int c = readCh(); c != 0x3b && c != -1; c = readCh()) b.append(Character.toChars(c)); try @@ -4246,7 +4248,7 @@ throws XMLStreamException { // Use regular expression - StringBuffer buf = new StringBuffer(); + CPStringBuilder buf = new CPStringBuilder(); for (Iterator i = children.iterator(); i.hasNext(); ) { buf.append((String) i.next()); @@ -4266,7 +4268,7 @@ { if (model.regex == null) { - StringBuffer buf = new StringBuffer(); + CPStringBuilder buf = new CPStringBuilder(); buf.append('('); for (Iterator i = model.contentParticles.iterator(); i.hasNext(); ) { @@ -4476,7 +4478,7 @@ */ private static String encodeText(String text) { - StringBuffer b = new StringBuffer(); + CPStringBuilder b = new CPStringBuilder(); int len = text.length(); for (int i = 0; i < len; i++) { @@ -4584,7 +4586,7 @@ public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); + CPStringBuilder buf = new CPStringBuilder(getClass().getName()); buf.append('['); buf.append("name="); buf.append(name); Index: gnu/xml/validation/datatype/EntitiesType.java =================================================================== RCS file: /sources/classpath/classpath/gnu/xml/validation/datatype/EntitiesType.java,v retrieving revision 1.1 diff -u -r1.1 EntitiesType.java --- gnu/xml/validation/datatype/EntitiesType.java 13 Feb 2006 19:27:24 -0000 1.1 +++ gnu/xml/validation/datatype/EntitiesType.java 6 May 2008 01:03:52 -0000 @@ -37,6 +37,8 @@ package gnu.xml.validation.datatype; +import gnu.java.lang.CPStringBuilder; + import javax.xml.XMLConstants; import javax.xml.namespace.QName; import org.relaxng.datatype.DatatypeException; @@ -75,7 +77,7 @@ throws DatatypeException { super.checkValid(value, context); - StringBuffer buf = new StringBuffer(); + CPStringBuilder buf = new CPStringBuilder(); int len = value.length(); for (int i = 0; i < len; i++) { Index: gnu/xml/validation/datatype/NMTokensType.java =================================================================== RCS file: /sources/classpath/classpath/gnu/xml/validation/datatype/NMTokensType.java,v retrieving revision 1.1 diff -u -r1.1 NMTokensType.java --- gnu/xml/validation/datatype/NMTokensType.java 13 Feb 2006 19:27:24 -0000 1.1 +++ gnu/xml/validation/datatype/NMTokensType.java 6 May 2008 01:03:52 -0000 @@ -37,6 +37,8 @@ package gnu.xml.validation.datatype; +import gnu.java.lang.CPStringBuilder; + import java.io.IOException; import javax.xml.XMLConstants; import javax.xml.namespace.QName; @@ -79,7 +81,7 @@ { super.checkValid(value, context); int len = value.length(); - StringBuffer buf = new StringBuffer(); + CPStringBuilder buf = new CPStringBuilder(); for (int i = 0; i < len; i++) { char c = value.charAt(i);