replace some StringBuffers

git-svn-id: https://svn.apache.org/repos/asf/xmlbeans/trunk@1870125 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/tools/org/apache/xmlbeans/impl/xsd2inst/SampleXmlUtil.java b/src/tools/org/apache/xmlbeans/impl/xsd2inst/SampleXmlUtil.java
index f7be6ae..bf80809 100644
--- a/src/tools/org/apache/xmlbeans/impl/xsd2inst/SampleXmlUtil.java
+++ b/src/tools/org/apache/xmlbeans/impl/xsd2inst/SampleXmlUtil.java
@@ -360,7 +360,7 @@
             return "";
             
         int i = pick(a.length);
-        StringBuffer sb = new StringBuffer(a[i]);
+        StringBuilder sb = new StringBuilder(a[i]);
         while (count-- > 0)
         {
             i += 1;
@@ -477,7 +477,7 @@
         {
             totalDigits = xmlD.getBigDecimalValue().intValue();
 
-            StringBuffer sb = new StringBuffer(totalDigits);
+            StringBuilder sb = new StringBuilder(totalDigits);
             for (int i = 0; i < totalDigits; i++)
                 sb.append('9');
             BigDecimal digitsLimit = new BigDecimal(sb.toString());
@@ -1157,7 +1157,7 @@
 
     private String printParticleType(int particleType)
     {
-        StringBuffer returnParticleType = new StringBuffer();
+        StringBuilder returnParticleType = new StringBuilder();
         returnParticleType.append("Schema Particle Type: ");
 
         switch (particleType)
diff --git a/src/typeimpl/org/apache/xmlbeans/impl/regex/Token.java b/src/typeimpl/org/apache/xmlbeans/impl/regex/Token.java
index 6d333e2..16f9ebd 100644
--- a/src/typeimpl/org/apache/xmlbeans/impl/regex/Token.java
+++ b/src/typeimpl/org/apache/xmlbeans/impl/regex/Token.java
@@ -828,7 +828,7 @@
                 //REVISIT: do we really need to support block names as in Unicode 3.1
                 //         or we can just create all the names in IsBLOCKNAME format (XML Schema REC)?
                 //
-                StringBuffer buffer = new StringBuffer(50);
+                StringBuilder buffer = new StringBuilder(50);
                 for (int i = 0;  i < Token.blockNames.length;  i ++) {
                     Token r1 = Token.createRange();
                     int location;
@@ -1441,10 +1441,10 @@
             
             //System.err.println("Merge '"+previous+"' and '"+tok+"'.");
 
-            StringBuffer buffer;
+            StringBuilder buffer;
             int nextMaxLength = (tok.type == CHAR ? 2 : tok.getString().length());
             if (previous.type == CHAR) {        // Replace previous token by STRING
-                buffer = new StringBuffer(2 + nextMaxLength);
+                buffer = new StringBuilder(2 + nextMaxLength);
                 int ch = previous.getChar();
                 if (ch >= 0x10000)
                     buffer.append(REUtil.decomposeToSurrogates(ch));
@@ -1453,7 +1453,7 @@
                 previous = Token.createString(null);
                 this.children.setElementAt(previous, size-1);
             } else {                            // STRING
-                buffer = new StringBuffer(previous.getString().length() + nextMaxLength);
+                buffer = new StringBuilder(previous.getString().length() + nextMaxLength);
                 buffer.append(previous.getString());
             }
 
diff --git a/src/typeimpl/org/apache/xmlbeans/impl/validator/ValidatingXMLInputStream.java b/src/typeimpl/org/apache/xmlbeans/impl/validator/ValidatingXMLInputStream.java
index cc01bf2..614dc3b 100644
--- a/src/typeimpl/org/apache/xmlbeans/impl/validator/ValidatingXMLInputStream.java
+++ b/src/typeimpl/org/apache/xmlbeans/impl/validator/ValidatingXMLInputStream.java
@@ -378,7 +378,7 @@
 
     private XMLInputStream _source;
     private Validator      _validator;
-    private StringBuffer   _text = new StringBuffer();
+    private StringBuilder   _text = new StringBuilder();
     private boolean        _finished;
     private String         _xsiType;
     private String         _xsiNil;
diff --git a/src/xmlcomp/org/apache/xmlbeans/impl/tool/XsbDumper.java b/src/xmlcomp/org/apache/xmlbeans/impl/tool/XsbDumper.java
index d13ce42..f7757ba 100644
--- a/src/xmlcomp/org/apache/xmlbeans/impl/tool/XsbDumper.java
+++ b/src/xmlcomp/org/apache/xmlbeans/impl/tool/XsbDumper.java
@@ -192,7 +192,7 @@
 
     static String particleflagsString(int flags)
     {
-        StringBuffer result = new StringBuffer();
+        StringBuilder result = new StringBuilder();
         if ((flags & FLAG_PART_SKIPPABLE) != 0) result.append("FLAG_PART_SKIPPABLE | ");
         if ((flags & FLAG_PART_FIXED) != 0) result.append("FLAG_PART_FIXED | ");
         if ((flags & FLAG_PART_NILLABLE) != 0) result.append("FLAG_PART_NILLABLE | ");
@@ -213,7 +213,7 @@
 
     static String propertyflagsString(int flags)
     {
-        StringBuffer result = new StringBuffer();
+        StringBuilder result = new StringBuilder();
         if ((flags & FLAG_PROP_ISATTR) != 0) result.append("FLAG_PROP_ISATTR | ");
         if ((flags & FLAG_PROP_JAVASINGLETON) != 0) result.append("FLAG_PROP_JAVASINGLETON | ");
         if ((flags & FLAG_PROP_JAVAOPTIONAL) != 0) result.append("FLAG_PROP_JAVAOPTIONAL | ");
@@ -264,7 +264,7 @@
 
     static String typeflagsString(int flags)
     {
-        StringBuffer result = new StringBuffer();
+        StringBuilder result = new StringBuilder();
         if ((flags & FLAG_SIMPLE_TYPE) != 0) result.append("FLAG_SIMPLE_TYPE | ");
         if ((flags & FLAG_DOCUMENT_TYPE) != 0) result.append("FLAG_DOCUMENT_TYPE | ");
         if ((flags & FLAG_ATTRIBUTE_TYPE) != 0) result.append("FLAG_ATTRIBUTE_TYPE | ");
diff --git a/src/xmlconfig/org/apache/xmlbeans/impl/config/InterfaceExtensionImpl.java b/src/xmlconfig/org/apache/xmlbeans/impl/config/InterfaceExtensionImpl.java
index e932fb4..a138b19 100755
--- a/src/xmlconfig/org/apache/xmlbeans/impl/config/InterfaceExtensionImpl.java
+++ b/src/xmlconfig/org/apache/xmlbeans/impl/config/InterfaceExtensionImpl.java
@@ -207,7 +207,7 @@
 
     private static String listTypes(JClass[] types)
     {
-        StringBuffer result = new StringBuffer();
+        StringBuilder result = new StringBuilder();
         for (int i = 0; i < types.length; i++)
         {
             JClass type = types[i];
@@ -220,7 +220,7 @@
 
     private static String listTypes(JParameter[] params)
     {
-        StringBuffer result = new StringBuffer();
+        StringBuilder result = new StringBuilder();
         for (int i = 0; i < params.length; i++)
         {
             JClass type = params[i].getType();
@@ -388,7 +388,7 @@
             if (_signature!=null)
                 return _signature;
 
-            StringBuffer sb = new StringBuffer(60);
+            StringBuilder sb = new StringBuilder(60);
             sb.append(_name).append("(");
             for (int i = 0; i < _params.length; i++)
                 sb.append((i == 0 ? "" : " ,")).append(_params[i]);
diff --git a/src/xmlpublic/org/apache/xmlbeans/GDurationBuilder.java b/src/xmlpublic/org/apache/xmlbeans/GDurationBuilder.java
index 23b8caf..a07ffdc 100644
--- a/src/xmlpublic/org/apache/xmlbeans/GDurationBuilder.java
+++ b/src/xmlpublic/org/apache/xmlbeans/GDurationBuilder.java
@@ -532,7 +532,7 @@
         // Minutes:        (?:(\d+)M)?
         // Seconds:        (?:(\d+(?:\.\d*)?|(?:.\d+)S)?
 
-        StringBuffer message = new StringBuffer(30);
+        StringBuilder message = new StringBuilder(30);
 
         if (duration.getSign() < 0)
             message.append('-');
@@ -608,7 +608,7 @@
 
         int point = intValStr.length() - scale - (isNegative ? 1 : 0);
 
-        StringBuffer sb = new StringBuffer(intValStr.length() + 2 + (point <= 0 ? (-point + 1) : 0));
+        StringBuilder sb = new StringBuilder(intValStr.length() + 2 + (point <= 0 ? (-point + 1) : 0));
         if (point <= 0)
         {
             // prepend zeros and a decimal point.
diff --git a/src/xmlpublic/org/apache/xmlbeans/XmlSimpleList.java b/src/xmlpublic/org/apache/xmlbeans/XmlSimpleList.java
index cde96f8..12557ca 100644
--- a/src/xmlpublic/org/apache/xmlbeans/XmlSimpleList.java
+++ b/src/xmlpublic/org/apache/xmlbeans/XmlSimpleList.java
@@ -137,7 +137,7 @@
         String first = stringValue(underlying.get(0));
         if (size == 1)
             return first;
-        StringBuffer result = new StringBuffer(first);
+        StringBuilder result = new StringBuilder(first);
         for (int i = 1; i < size; i++)
         {
             result.append(' ');
diff --git a/test/perf/src/org/apache/xmlbeans/test/performance/xerces/POTopDownXercesSax.java b/test/perf/src/org/apache/xmlbeans/test/performance/xerces/POTopDownXercesSax.java
index 3d14dda..8844cec 100644
--- a/test/perf/src/org/apache/xmlbeans/test/performance/xerces/POTopDownXercesSax.java
+++ b/test/perf/src/org/apache/xmlbeans/test/performance/xerces/POTopDownXercesSax.java
@@ -129,7 +129,7 @@
   public static class MyHandler extends DefaultHandler
   {
     private int _hash = 0;
-    private StringBuffer _buff;
+    private StringBuilder _buff;
     private String _uri;
     private String _prefix;
     private final String SES = "<";
@@ -153,7 +153,7 @@
     // sax event handlers
     public void startDocument() throws SAXException
     {
-      _buff = new StringBuffer(Constants.initialBuffSize);
+      _buff = new StringBuilder(Constants.initialBuffSize);
     }
 
     /*
diff --git a/test/perf/src/org/apache/xmlbeans/test/tools/PerfResultUtil.java b/test/perf/src/org/apache/xmlbeans/test/tools/PerfResultUtil.java
index 5dfea79..65d20c0 100644
--- a/test/perf/src/org/apache/xmlbeans/test/tools/PerfResultUtil.java
+++ b/test/perf/src/org/apache/xmlbeans/test/tools/PerfResultUtil.java
@@ -45,7 +45,7 @@
 		final String HASH = "hash";
 		
 		FileReader reader = new FileReader(p_filename);
-		StringBuffer buff = new StringBuffer();
+		StringBuilder buff = new StringBuilder();
 		int c;
 		while( (c=reader.read()) != -1)
 		{
diff --git a/test/src/misc/detailed/JiraRegression1_50Test.java b/test/src/misc/detailed/JiraRegression1_50Test.java
index 700f305..30b3f1e 100644
--- a/test/src/misc/detailed/JiraRegression1_50Test.java
+++ b/test/src/misc/detailed/JiraRegression1_50Test.java
@@ -96,7 +96,7 @@
     public void test_jira_xmlbeans09() throws Exception {

         // Exec validate script from cmd line - Refer xmlbeans_09.xsd, xmlbeans_09.xml

 

-        StringBuffer sb = new StringBuffer(" ");

+        StringBuilder sb = new StringBuilder(" ");

         sb.append(System.getProperty("xbean.rootdir") + P + "bin" + P + "validate.cmd ");

         sb.append(scompTestFilesRoot + "xmlbeans_09.xsd_" + " " + scompTestFilesRoot + "xmlbeans_09.xml");

         Process validator_proc = null;

@@ -129,7 +129,7 @@
     @Test

     public void test_jira_xmlbeans11() throws Exception {

 

-        StringBuffer xsdAsString = new StringBuffer("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");

+        StringBuilder xsdAsString = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");

         xsdAsString.append(" <!-- W3C Schema generated by XML Spy v4.3 U (http://www.xmlspy.com)\n");

         xsdAsString.append("  --> \n");

         xsdAsString.append(" <xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" elementFormDefault=\"qualified\">\n");

@@ -199,7 +199,7 @@
     @Test

     @Ignore("still happens with current xerces 2.11")

     public void test_jira_xmlbeans16() throws Exception {

-        StringBuffer sb = new StringBuffer(100);

+        StringBuilder sb = new StringBuilder(100);

         sb.append("<?xml version='1.0'?>\n");

         sb.append("<test noprefix='nonamespace' \n");

         sb.append("      ns:prefix='namespace' \n");