8055723: Replace concat String to append in StringBuilder parameters (dev)
authorweijun
Thu, 11 Dec 2014 15:23:02 +0800
changeset 27957 24b4e6082f19
parent 27956 7e6ab24dd745
child 27958 51c87937ff0c
8055723: Replace concat String to append in StringBuilder parameters (dev) Reviewed-by: redestad, ulfzibis, weijun, prappo, igerasim, alanb Contributed-by: Otavio Santana <otaviojava@java.net>
jdk/src/java.base/share/classes/java/text/ChoiceFormat.java
jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java
jdk/src/java.base/share/classes/sun/net/www/HeaderParser.java
jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java
jdk/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNNameParser.java
jdk/src/java.management/share/classes/javax/management/MBeanPermission.java
jdk/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java
jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java
jdk/src/java.management/share/classes/sun/management/Agent.java
jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java
jdk/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java
jdk/src/java.naming/share/classes/javax/naming/NameImpl.java
jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbException.java
jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/DkCrypto.java
jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java
jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java
jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/encryption/AbstractSerializer.java
jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces.java
jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/RFC2253Parser.java
jdk/src/jdk.dev/share/classes/com/sun/tools/hat/internal/model/JavaValueArray.java
jdk/src/jdk.dev/share/classes/com/sun/tools/hat/internal/util/Misc.java
jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java
jdk/src/jdk.jcmd/share/classes/sun/tools/jps/Jps.java
jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/RawOutputFormatter.java
jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/SyntaxException.java
jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/ThreadTab.java
jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XArrayDataViewer.java
jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XTree.java
jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/ParseException.java
jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java
jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java
jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/RemoteHostImpl.java
jdk/src/jdk.naming.dns/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java
jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/PolicyTool.java
--- a/jdk/src/java.base/share/classes/java/text/ChoiceFormat.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.base/share/classes/java/text/ChoiceFormat.java	Thu Dec 11 15:23:02 2014 +0800
@@ -272,7 +272,7 @@
             double tryLess = Math.abs(Math.IEEEremainder(less, 1.0d));
 
             if (tryLessOrEqual < tryLess) {
-                result.append(""+choiceLimits[i]);
+                result.append(choiceLimits[i]);
                 result.append('#');
             } else {
                 if (choiceLimits[i] == Double.POSITIVE_INFINITY) {
@@ -280,7 +280,7 @@
                 } else if (choiceLimits[i] == Double.NEGATIVE_INFINITY) {
                     result.append("-\u221E");
                 } else {
-                    result.append(""+less);
+                    result.append(less);
                 }
                 result.append('<');
             }
--- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Thu Dec 11 15:23:02 2014 +0800
@@ -369,10 +369,9 @@
     static void appendVmErgoMessage(boolean isServerClass, String vm) {
         outBuf = outBuf.append(getLocalizedMessage("java.launcher.ergo.message1",
                 vm));
-        outBuf = (isServerClass)
-             ? outBuf.append(",\n" +
-                getLocalizedMessage("java.launcher.ergo.message2") + "\n\n")
-             : outBuf.append(".\n\n");
+        outBuf = (isServerClass) ? outBuf.append(",\n")
+                .append(getLocalizedMessage("java.launcher.ergo.message2"))
+                .append("\n\n") : outBuf.append(".\n\n");
     }
 
     /**
--- a/jdk/src/java.base/share/classes/sun/net/www/HeaderParser.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/net/www/HeaderParser.java	Thu Dec 11 15:23:02 2014 +0800
@@ -220,21 +220,23 @@
 
     public String toString () {
         Iterator<String> k = keys();
-        StringBuffer sbuf = new StringBuffer();
-        sbuf.append ("{size="+asize+" nkeys="+nkeys+" ");
+        StringBuilder sb = new StringBuilder();
+        sb.append("{size=").append(asize).append(" nkeys=").append(nkeys)
+                .append(' ');
         for (int i=0; k.hasNext(); i++) {
             String key = k.next();
             String val = findValue (i);
             if (val != null && "".equals (val)) {
                 val = null;
             }
-            sbuf.append (" {"+key+(val==null?"":","+val)+"}");
+            sb.append(" {").append(key).append(val == null ? "" : "," + val)
+                    .append('}');
             if (k.hasNext()) {
-                sbuf.append (",");
+                sb.append (',');
             }
         }
-        sbuf.append (" }");
-        return new String (sbuf);
+        sb.append (" }");
+        return sb.toString();
     }
 
     public int findInt(String k, int Default) {
--- a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java	Thu Dec 11 15:23:02 2014 +0800
@@ -1478,7 +1478,7 @@
                 boolean opened = false;
                 for (SignatureAndHashAlgorithm signAlg : algorithms) {
                     if (opened) {
-                        sb.append(", " + signAlg.getAlgorithmName());
+                        sb.append(", ").append(signAlg.getAlgorithmName());
                     } else {
                         sb.append(signAlg.getAlgorithmName());
                         opened = true;
--- a/jdk/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNNameParser.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNNameParser.java	Thu Dec 11 15:23:02 2014 +0800
@@ -256,7 +256,7 @@
     private static String stringifyComponent(NameComponent comp) {
         StringBuilder one = new StringBuilder(escape(comp.id));
         if (comp.kind != null && !comp.kind.equals("")) {
-            one.append(kindSeparator + escape(comp.kind));
+            one.append(kindSeparator).append(escape(comp.kind));
         }
         if (one.length() == 0) {
             return ""+kindSeparator;  // if neither id nor kind specified
--- a/jdk/src/java.management/share/classes/javax/management/MBeanPermission.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.management/share/classes/javax/management/MBeanPermission.java	Thu Dec 11 15:23:02 2014 +0800
@@ -455,11 +455,11 @@
         name.append(className);
         if (member == null)
             member = "-";
-        name.append("#" + member);
+        name.append('#').append(member);
         if (objectName == null)
             name.append("[-]");
         else
-            name.append("[").append(objectName.getCanonicalName()).append("]");
+            name.append('[').append(objectName.getCanonicalName()).append(']');
 
         /* In the interests of legibility for Permission.toString(), we
            transform the empty string into "*".  */
--- a/jdk/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java	Thu Dec 11 15:23:02 2014 +0800
@@ -716,15 +716,14 @@
         }
 
         retStr.append("\nMBeanInfo for ModelMBean is:");
-        retStr.append("\nCLASSNAME: \t"+ info.getClassName());
-        retStr.append("\nDESCRIPTION: \t"+ info.getDescription());
+        retStr.append("\nCLASSNAME: \t").append(info.getClassName());
+        retStr.append("\nDESCRIPTION: \t").append(info.getDescription());
 
 
         try {
-            retStr.append("\nMBEAN DESCRIPTOR: \t"+
-                          info.getMBeanDescriptor());
+            retStr.append("\nMBEAN DESCRIPTOR: \t").append(info.getMBeanDescriptor());
         } catch (Exception e) {
-            retStr.append("\nMBEAN DESCRIPTOR: \t" + " is invalid");
+            retStr.append("\nMBEAN DESCRIPTOR: \t  is invalid");
         }
 
         retStr.append("\nATTRIBUTES");
@@ -734,13 +733,12 @@
             for (int i=0; i<attrInfo.length; i++) {
                 final ModelMBeanAttributeInfo attInfo =
                     (ModelMBeanAttributeInfo)attrInfo[i];
-                retStr.append(" ** NAME: \t"+ attInfo.getName());
-                retStr.append("    DESCR: \t"+ attInfo.getDescription());
-                retStr.append("    TYPE: \t"+ attInfo.getType() +
-                              "    READ: \t"+ attInfo.isReadable() +
-                              "    WRITE: \t"+ attInfo.isWritable());
-                retStr.append("    DESCRIPTOR: " +
-                              attInfo.getDescriptor().toString());
+                retStr.append(" ** NAME: \t").append(attInfo.getName());
+                retStr.append("    DESCR: \t").append(attInfo.getDescription());
+                retStr.append("    TYPE: \t").append(attInfo.getType())
+                        .append("    READ: \t").append(attInfo.isReadable())
+                        .append("    WRITE: \t").append(attInfo.isWritable());
+                retStr.append("    DESCRIPTOR: ").append(attInfo.getDescriptor());
             }
         } else {
             retStr.append(" ** No attributes **");
@@ -752,14 +750,13 @@
             for (int i=0; i<constrInfo.length; i++) {
                 final ModelMBeanConstructorInfo ctorInfo =
                     (ModelMBeanConstructorInfo)constrInfo[i];
-                retStr.append(" ** NAME: \t"+ ctorInfo.getName());
-                retStr.append("    DESCR: \t"+
-                              ctorInfo.getDescription());
-                retStr.append("    PARAM: \t"+
-                              ctorInfo.getSignature().length +
-                              " parameter(s)");
-                retStr.append("    DESCRIPTOR: " +
-                              ctorInfo.getDescriptor().toString());
+                retStr.append(" ** NAME: \t").append(ctorInfo.getName());
+                retStr.append("    DESCR: \t").append(ctorInfo.getDescription());
+                retStr.append("    PARAM: \t")
+                        .append(ctorInfo.getSignature().length)
+                        .append(" parameter(s)");
+                retStr.append("    DESCRIPTOR: ").append(
+                        ctorInfo.getDescriptor());
             }
         } else {
             retStr.append(" ** No Constructors **");
@@ -771,13 +768,12 @@
             for (int i=0; i<opsInfo.length; i++) {
                 final ModelMBeanOperationInfo operInfo =
                     (ModelMBeanOperationInfo)opsInfo[i];
-                retStr.append(" ** NAME: \t"+ operInfo.getName());
-                retStr.append("    DESCR: \t"+ operInfo.getDescription());
-                retStr.append("    PARAM: \t"+
-                              operInfo.getSignature().length +
-                              " parameter(s)");
-                retStr.append("    DESCRIPTOR: " +
-                              operInfo.getDescriptor().toString());
+                retStr.append(" ** NAME: \t").append(operInfo.getName());
+                retStr.append("    DESCR: \t").append(operInfo.getDescription());
+                retStr.append("    PARAM: \t")
+                        .append(operInfo.getSignature().length)
+                        .append(" parameter(s)");
+                retStr.append("    DESCRIPTOR: ").append(operInfo.getDescriptor());
             }
         } else {
             retStr.append(" ** No operations ** ");
@@ -790,10 +786,9 @@
             for (int i=0; i<notifInfo.length; i++) {
                 final ModelMBeanNotificationInfo nInfo =
                     (ModelMBeanNotificationInfo)notifInfo[i];
-                retStr.append(" ** NAME: \t"+ nInfo.getName());
-                retStr.append("    DESCR: \t"+ nInfo.getDescription());
-                retStr.append("    DESCRIPTOR: " +
-                              nInfo.getDescriptor().toString());
+                retStr.append(" ** NAME: \t").append(nInfo.getName());
+                retStr.append("    DESCR: \t").append(nInfo.getDescription());
+                retStr.append("    DESCRIPTOR: ").append(nInfo.getDescriptor());
             }
         } else {
             retStr.append(" ** No notifications **");
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java	Thu Dec 11 15:23:02 2014 +0800
@@ -458,8 +458,8 @@
             elementType = at.getElementOpenType();
             isPrimitiveArray = at.isPrimitiveArray();
         }
-        StringBuilder result =
-            new StringBuilder(dimension + "-dimension array of ");
+        StringBuilder result = new StringBuilder();
+        result.append(dimension).append("-dimension array of ");
         final String elementClassName = elementType.getClassName();
         if (isPrimitiveArray) {
             // Convert from wrapper type to primitive type
--- a/jdk/src/java.management/share/classes/sun/management/Agent.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.management/share/classes/sun/management/Agent.java	Thu Dec 11 15:23:02 2014 +0800
@@ -499,7 +499,7 @@
         } else {
             StringBuilder message = new StringBuilder(params[0]);
             for (int i = 1; i < params.length; i++) {
-                message.append(" " + params[i]);
+                message.append(' ').append(params[i]);
             }
             error(key, message.toString());
         }
--- a/jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java	Thu Dec 11 15:23:02 2014 +0800
@@ -289,7 +289,7 @@
             if (et.isPrimitive()) {
                 className = new StringBuilder(c.getName());
             } else {
-                className.append("L" + baseElementType.getTypeName() + ";");
+                className.append('L').append(baseElementType.getTypeName()).append(';');
             }
             try {
                 mappedTypeClass = Class.forName(className.toString());
@@ -385,7 +385,7 @@
             if (elementType instanceof Class && ((Class) elementType).isPrimitive()) {
                 className = new StringBuilder(gat.toString());
             } else {
-                className.append("L" + baseElementType.getTypeName() + ";");
+                className.append('L').append(baseElementType.getTypeName()).append(';');
             }
             try {
                 mappedTypeClass = Class.forName(className.toString());
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java	Thu Dec 11 15:23:02 2014 +0800
@@ -90,7 +90,7 @@
                         if (selected == -1) {
                             StringBuilder allChoices = new StringBuilder();
                             for (int j = 0; j <  choices.length; j++) {
-                                allChoices.append(choices[j] + ",");
+                                allChoices.append(choices[j]).append(',');
                             }
                             throw new IOException("Cannot match " +
                                 "'java.naming.security.sasl.realm' property value, '" +
--- a/jdk/src/java.naming/share/classes/javax/naming/NameImpl.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.naming/share/classes/javax/naming/NameImpl.java	Thu Dec 11 15:23:02 2014 +0800
@@ -170,7 +170,7 @@
                 endQuote = one ? syntaxEndQuote1 : syntaxEndQuote2;
 
                 i += syntaxTypevalSeparator.length();
-                answer.append(syntaxTypevalSeparator+beginQuote); // add back
+                answer.append(syntaxTypevalSeparator).append(beginQuote); // add back
 
                 // consume string until matching quote
                 for (i += beginQuote.length();
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbException.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbException.java	Thu Dec 11 15:23:02 2014 +0800
@@ -96,13 +96,14 @@
 
 
     public String krbErrorMessage() {
-        StringBuilder strbuf = new StringBuilder("krb_error " + returnCode);
+        StringBuilder sb = new StringBuilder();
+        sb.append("krb_error ").append(returnCode);
         String msg =  getMessage();
         if (msg != null) {
-            strbuf.append(" ");
-            strbuf.append(msg);
+            sb.append(" ");
+            sb.append(msg);
         }
-        return strbuf.toString();
+        return sb.toString();
     }
 
     /**
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/DkCrypto.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/DkCrypto.java	Thu Dec 11 15:23:02 2014 +0800
@@ -640,8 +640,7 @@
 
         for (int i = 0; i < digest.length; i++) {
             if ((digest[i] & 0x000000ff) < 0x10) {
-                digestString.append("0" +
-                    Integer.toHexString(digest[i] & 0x000000ff));
+                digestString.append('0').append(Integer.toHexString(digest[i] & 0x000000ff));
             } else {
                 digestString.append(
                     Integer.toHexString(digest[i] & 0x000000ff));
--- a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java	Thu Dec 11 15:23:02 2014 +0800
@@ -196,8 +196,7 @@
 
         for (i = 0; i < digest.length; i++) {
             if ((digest[i] & 0x000000ff) < 0x10) {
-                digestString.append("0" +
-                    Integer.toHexString(digest[i] & 0x000000ff));
+                digestString.append('0').append(Integer.toHexString(digest[i] & 0x000000ff));
             } else {
                 digestString.append(
                     Integer.toHexString(digest[i] & 0x000000ff));
--- a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java	Thu Dec 11 15:23:02 2014 +0800
@@ -391,8 +391,7 @@
 
         for (int i = 0; i < digest.length; i ++) {
             if ((digest[i] & 0x000000ff) < 0x10) {
-                digestString.append("0"+
-                    Integer.toHexString(digest[i] & 0x000000ff));
+                digestString.append('0').append(Integer.toHexString(digest[i] & 0x000000ff));
             } else {
                 digestString.append(
                     Integer.toHexString(digest[i] & 0x000000ff));
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/encryption/AbstractSerializer.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/encryption/AbstractSerializer.java	Thu Dec 11 15:23:02 2014 +0800
@@ -235,14 +235,15 @@
                     String nodeName = att.getNodeName();
                     if ((nodeName.equals("xmlns") || nodeName.startsWith("xmlns:"))
                         && !storedNamespaces.containsKey(att.getNodeName())) {
-                        sb.append(" " + nodeName + "=\"" + att.getNodeValue() + "\"");
+                        sb.append(' ').append(nodeName).append("=\"")
+                                .append(att.getNodeValue()).append('"');
                         storedNamespaces.put(nodeName, att.getNodeValue());
                     }
                 }
             }
             wk = wk.getParentNode();
         }
-        sb.append(">" + source + "</dummy>");
+        sb.append('>').append(source).append("</dummy>");
         return sb.toString();
     }
 
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces.java	Thu Dec 11 15:23:02 2014 +0800
@@ -85,7 +85,7 @@
             if (prefix.equals("xmlns")) {
                 sb.append("#default ");
             } else {
-                sb.append(prefix + " ");
+                sb.append(prefix).append(' ');
             }
         }
 
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/RFC2253Parser.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/RFC2253Parser.java	Thu Dec 11 15:23:02 2014 +0800
@@ -88,7 +88,7 @@
                 l += countQuotes(DN, j, k);
 
                 if ((k > 0) && (DN.charAt(k - 1) != '\\') && (l % 2) == 0) {
-                    sb.append(parseRDN(DN.substring(i, k).trim(), toXml) + ",");
+                    sb.append(parseRDN(DN.substring(i, k).trim(), toXml)).append(',');
 
                     i = k + 1;
                     l = 0;
@@ -121,7 +121,7 @@
             l += countQuotes(str, j, k);
 
             if ((k > 0) && (str.charAt(k - 1) != '\\') && (l % 2) == 0) {
-                sb.append(parseATAV(trim(str.substring(i, k)), toXml) + "+");
+                sb.append(parseATAV(trim(str.substring(i, k)), toXml)).append('+');
 
                 i = k + 1;
                 l = 0;
@@ -369,7 +369,7 @@
         int k;
 
         for (int j = 0; (k = string.indexOf("\\20", j)) >= 0; j = k + 3) {
-            sb.append(trim(string.substring(i, k)) + "\\ ");
+            sb.append(trim(string.substring(i, k))).append("\\ ");
 
             i = k + 3;
         }
@@ -418,7 +418,7 @@
             l += countQuotes(str, j, k);
 
             if ((k > 0) && (str.charAt(k - 1) != '\\') && (l % 2) == 0) {
-                sb.append(trim(str.substring(i, k)) + replace);
+                sb.append(trim(str.substring(i, k))).append(replace);
 
                 i = k + 1;
                 l = 0;
--- a/jdk/src/jdk.dev/share/classes/com/sun/tools/hat/internal/model/JavaValueArray.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.dev/share/classes/com/sun/tools/hat/internal/model/JavaValueArray.java	Thu Dec 11 15:23:02 2014 +0800
@@ -346,12 +346,12 @@
 
     public String valueString(boolean bigLimit) {
         // Char arrays deserve special treatment
-        StringBuffer result;
+        StringBuilder result;
         byte[] value = getValue();
         int max = value.length;
         byte elementSignature = getElementType();
         if (elementSignature == 'C')  {
-            result = new StringBuffer();
+            result = new StringBuilder();
             for (int i = 0; i < value.length; ) {
                 char val = charAt(i, value);
                 result.append(val);
@@ -362,7 +362,7 @@
             if (bigLimit) {
                 limit = 1000;
             }
-            result = new StringBuffer("{");
+            result = new StringBuilder("{");
             int num = 0;
             for (int i = 0; i < value.length; ) {
                 if (num > 0) {
@@ -386,37 +386,37 @@
                     }
                     case 'B': {
                         int val = 0xFF & byteAt(i, value);
-                        result.append("0x" + Integer.toString(val, 16));
+                        result.append("0x").append(Integer.toString(val, 16));
                         i++;
                         break;
                     }
                     case 'S': {
                         short val = shortAt(i, value);
                         i += 2;
-                        result.append("" + val);
+                        result.append(val);
                         break;
                     }
                     case 'I': {
                         int val = intAt(i, value);
                         i += 4;
-                        result.append("" + val);
+                        result.append(val);
                         break;
                     }
                     case 'J': {         // long
                         long val = longAt(i, value);
-                        result.append("" + val);
+                        result.append(val);
                         i += 8;
                         break;
                     }
                     case 'F': {
                         float val = floatAt(i, value);
-                        result.append("" + val);
+                        result.append(val);
                         i += 4;
                         break;
                     }
                     case 'D': {         // double
                         double val = doubleAt(i, value);
-                        result.append("" + val);
+                        result.append(val);
                         i += 8;
                         break;
                     }
@@ -425,7 +425,7 @@
                     }
                 }
             }
-            result.append("}");
+            result.append('}');
         }
         return result.toString();
     }
--- a/jdk/src/jdk.dev/share/classes/com/sun/tools/hat/internal/util/Misc.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.dev/share/classes/com/sun/tools/hat/internal/util/Misc.java	Thu Dec 11 15:23:02 2014 +0800
@@ -97,11 +97,11 @@
             } else if (ch == '&') {
                 sb.append("&amp;");
             } else if (ch < ' ') {
-                sb.append("&#" + Integer.toString(ch) + ";");
+                sb.append("&#").append((int)ch).append(';');
             } else {
                 int c = (ch & 0xFFFF);
                 if (c > 127) {
-                    sb.append("&#" + Integer.toString(c) + ";");
+                    sb.append("&#").append(c).append(';');
                 } else {
                     sb.append(ch);
                 }
--- a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java	Thu Dec 11 15:23:02 2014 +0800
@@ -676,14 +676,13 @@
                             ((man.getAttributes(name) != null) ||
                              (man.getAttributes("./"+name) != null) ||
                              (man.getAttributes("/"+name) != null));
-                        sb.append(
-                          (isSigned ? rb.getString("s") : rb.getString("SPACE")) +
-                          (inManifest ? rb.getString("m") : rb.getString("SPACE")) +
-                          (inStore ? rb.getString("k") : rb.getString("SPACE")) +
-                          (inScope ? rb.getString("i") : rb.getString("SPACE")) +
-                          ((inStoreOrScope & NOT_ALIAS) != 0 ?"X":" ") +
-                          rb.getString("SPACE"));
-                        sb.append("|");
+                        sb.append(isSigned ? rb.getString("s") : rb.getString("SPACE"))
+                                .append(inManifest ? rb.getString("m") : rb.getString("SPACE"))
+                                .append(inStore ? rb.getString("k") : rb.getString("SPACE"))
+                                .append(inScope ? rb.getString("i") : rb.getString("SPACE"))
+                                .append((inStoreOrScope & NOT_ALIAS) != 0 ? 'X' : ' ')
+                                .append(rb.getString("SPACE"));
+                        sb.append('|');
                     }
 
                     // When -certs provided, display info has extra empty
@@ -704,11 +703,15 @@
                         // Print no info for unsigned entries when -verbose:all,
                         // to be consistent with old behavior.
                         if (signatureRelated(name)) {
-                            sb.append("\n" + tab + rb.getString(
-                                    ".Signature.related.entries.") + "\n\n");
+                            sb.append('\n')
+                                    .append(tab)
+                                    .append(rb
+                                            .getString(".Signature.related.entries."))
+                                    .append("\n\n");
                         } else {
-                            sb.append("\n" + tab + rb.getString(
-                                    ".Unsigned.entries.") + "\n\n");
+                            sb.append('\n').append(tab)
+                                    .append(rb.getString(".Unsigned.entries."))
+                                    .append("\n\n");
                         }
                     }
 
@@ -1605,8 +1608,8 @@
                 // No more warning, we alreay have hasExpiredCert or notYetValidCert
             } else {
                 chainNotValidated = true;
-                sb.append(tab + rb.getString(".CertPath.not.validated.") +
-                        e.getLocalizedMessage() + "]\n");   // TODO
+                sb.append(tab).append(rb.getString(".CertPath.not.validated."))
+                        .append(e.getLocalizedMessage()).append("]\n"); // TODO
             }
         }
         String result = sb.toString();
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/jps/Jps.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/jps/Jps.java	Thu Dec 11 15:23:02 2014 +0800
@@ -92,28 +92,28 @@
                     vm = monitoredHost.getMonitoredVm(id, 0);
 
                     errorString = " -- main class information unavailable";
-                    output.append(" " + MonitoredVmUtil.mainClass(vm,
+                    output.append(' ').append(MonitoredVmUtil.mainClass(vm,
                             arguments.showLongPaths()));
 
                     if (arguments.showMainArgs()) {
                         errorString = " -- main args information unavailable";
                         String mainArgs = MonitoredVmUtil.mainArgs(vm);
                         if (mainArgs != null && mainArgs.length() > 0) {
-                            output.append(" " + mainArgs);
+                            output.append(' ').append(mainArgs);
                         }
                     }
                     if (arguments.showVmArgs()) {
                         errorString = " -- jvm args information unavailable";
                         String jvmArgs = MonitoredVmUtil.jvmArgs(vm);
                         if (jvmArgs != null && jvmArgs.length() > 0) {
-                          output.append(" " + jvmArgs);
+                          output.append(' ').append(jvmArgs);
                         }
                     }
                     if (arguments.showVmFlags()) {
                         errorString = " -- jvm flags information unavailable";
                         String jvmFlags = MonitoredVmUtil.jvmFlags(vm);
                         if (jvmFlags != null && jvmFlags.length() > 0) {
-                            output.append(" " + jvmFlags);
+                            output.append(' ').append(jvmFlags);
                         }
                     }
 
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/RawOutputFormatter.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/RawOutputFormatter.java	Thu Dec 11 15:23:02 2014 +0800
@@ -50,7 +50,7 @@
             StringBuilder headerBuilder = new StringBuilder();
             for (Iterator<Monitor> i = logged.iterator(); i.hasNext(); /* empty */ ) {
                 Monitor m = i.next();
-                headerBuilder.append(m.getName() + " ");
+                headerBuilder.append(m.getName()).append(' ');
             }
             header = headerBuilder.toString();
         }
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/SyntaxException.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/SyntaxException.java	Thu Dec 11 15:23:02 2014 +0800
@@ -65,24 +65,21 @@
     public SyntaxException(int lineno, Set<String> expected, Token found) {
         StringBuilder msg = new StringBuilder();
 
-        msg.append("Syntax error at line " + lineno + ": Expected one of \'");
+        msg.append("Syntax error at line ").append(lineno)
+                .append(": Expected one of \'");
 
-        boolean first = true;
-        for (Iterator<String> i = expected.iterator(); i.hasNext(); /* empty */) {
-            String keyWord = i.next();
-            if (first) {
-                msg.append(keyWord);
-                first = false;
-            } else {
-                msg.append("|" + keyWord);
-            }
+        for (String keyWord : expected) {
+            msg.append(keyWord).append('|');
+        }
+        if (!expected.isEmpty()) {
+            msg.setLength(msg.length() - 1);
         }
 
-        msg.append("\', Found " + found.toMessage());
-        message = msg.toString();
+        message = msg.append("\', Found ").append(found.toMessage()).toString();
     }
 
     public String getMessage() {
         return message;
     }
 }
+
--- a/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/ThreadTab.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/ThreadTab.java	Thu Dec 11 15:23:02 2014 +0800
@@ -368,7 +368,7 @@
                             sb.append(Messages.STACK_TRACE);
                             int index = 0;
                             for (StackTraceElement e : ti.getStackTrace()) {
-                                sb.append(e.toString()+"\n");
+                                sb.append(e).append('\n');
                                 if (monitors != null) {
                                     for (MonitorInfo mi : monitors) {
                                         if (mi.getLockedStackDepth() == index) {
--- a/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XArrayDataViewer.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XArrayDataViewer.java	Thu Dec 11 15:23:02 2014 +0800
@@ -79,25 +79,25 @@
             String textColor = String.format("%06x",
                                              foreground.getRGB() & 0xFFFFFF);
             StringBuilder sb = new StringBuilder();
-            sb.append("<html><body text=#"+textColor+"><table width=\"100%\">");
+            sb.append("<html><body text=#").append(textColor).append("><table width=\"100%\">");
             for (int i = 0; i < arr.length; i++) {
                 if (i % 2 == 0) {
-                    sb.append("<tr style=\"background-color: " +
-                            evenRowColorStr + "\"><td><pre>" +
-                            (arr[i] == null ?
-                                arr[i] : htmlize(arr[i].toString())) +
-                            "</pre></td></tr>");
+                    sb.append("<tr style=\"background-color: ")
+                            .append(evenRowColorStr).append("\"><td><pre>")
+                            .append(arr[i] == null ?
+                                    arr[i] : htmlize(arr[i].toString()))
+                      .append("</pre></td></tr>");
                 } else {
-                    sb.append("<tr style=\"background-color: " +
-                            oddRowColorStr + "\"><td><pre>" +
-                            (arr[i] == null ?
-                                arr[i] : htmlize(arr[i].toString())) +
-                            "</pre></td></tr>");
+                    sb.append("<tr style=\"background-color: ")
+                            .append(oddRowColorStr).append("\"><td><pre>")
+                            .append(arr[i] == null ?
+                                    arr[i] : htmlize(arr[i].toString()))
+                            .append("</pre></td></tr>");
                 }
             }
             if (arr.length == 0) {
-                sb.append("<tr style=\"background-color: " +
-                        evenRowColorStr + "\"><td></td></tr>");
+                sb.append("<tr style=\"background-color: ")
+                        .append(evenRowColorStr).append("\"><td></td></tr>");
             }
             sb.append("</table></body></html>");
             arrayEditor.setText(sb.toString());
--- a/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XTree.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XTree.java	Thu Dec 11 15:23:02 2014 +0800
@@ -507,13 +507,13 @@
         // key order defined by the "orderedKeyPropertyList"
         for (String key : orderedKeyPropertyList) {
             if (map.containsKey(key)) {
-                sb.append(key + "=" + map.get(key) + ",");
+                sb.append(key).append('=').append(map.get(key)).append(',');
                 map.remove(key);
             }
         }
         // Add the remaining key/value pairs to the buffer
         for (Map.Entry<String, String> entry : map.entrySet()) {
-            sb.append(entry.getKey() + "=" + entry.getValue() + ",");
+            sb.append(entry.getKey()).append('=').append(entry.getValue()).append(',');
         }
         String orderedKeyPropertyListString = sb.toString();
         orderedKeyPropertyListString = orderedKeyPropertyListString.substring(
@@ -622,7 +622,7 @@
                     //
                     StringBuilder sb = new StringBuilder();
                     for (MBeanParameterInfo mbpi : mboi.getSignature()) {
-                        sb.append(mbpi.getType() + ",");
+                        sb.append(mbpi.getType()).append(',');
                     }
                     String signature = sb.toString();
                     if (signature.length() > 0) {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/ParseException.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/ParseException.java	Thu Dec 11 15:23:02 2014 +0800
@@ -198,7 +198,7 @@
            default:
               if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
                  String s = "0000" + Integer.toString(ch, 16);
-                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+                 retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
               } else {
                  retval.append(ch);
               }
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java	Thu Dec 11 15:23:02 2014 +0800
@@ -107,7 +107,7 @@
         default:
           if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
             String s = "0000" + Integer.toString(ch, 16);
-            retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+            retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
           } else {
             retval.append(ch);
           }
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java	Thu Dec 11 15:23:02 2014 +0800
@@ -881,12 +881,12 @@
             } else if (tag == JDWP.TypeTag.ARRAY) {
                 sb.append("ArrayType");
             } else {
-                sb.append("UNKNOWN TAG: " + tag);
+                sb.append("UNKNOWN TAG: ").append(tag);
             }
             if (signature != null) {
-                sb.append(", signature='" + signature + "'");
+                sb.append(", signature='").append(signature).append('\'');
             }
-            sb.append(", id=" + id);
+            sb.append(", id=").append(id);
             vm.printTrace(sb.toString());
         }
         if (id == 0) {
--- a/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/RemoteHostImpl.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/RemoteHostImpl.java	Thu Dec 11 15:23:02 2014 +0800
@@ -68,7 +68,7 @@
 
         sb.append("local://").append(lvmid).append("@localhost");
         if (mode != null) {
-            sb.append("?mode=" + mode);
+            sb.append("?mode=").append(mode);
         }
 
         String vmidStr = sb.toString();
--- a/jdk/src/jdk.naming.dns/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.naming.dns/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java	Thu Dec 11 15:23:02 2014 +0800
@@ -463,12 +463,12 @@
 
     // ---------
 
-    private static void appendIfLiteralAddress(String addr, StringBuffer sb) {
+    private static void appendIfLiteralAddress(String addr, StringBuilder sb) {
         if (IPAddressUtil.isIPv4LiteralAddress(addr)) {
-            sb.append("dns://" + addr + " ");
+            sb.append("dns://").append(addr).append(' ');
         } else {
             if (IPAddressUtil.isIPv6LiteralAddress(addr)) {
-                sb.append("dns://[" + addr + "] ");
+                sb.append("dns://[").append(addr).append("] ");
             }
         }
     }
@@ -478,7 +478,7 @@
      *         corresponding to the supplied List of nameservers.
      */
     private static String createProviderURL(List<String> nsList) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (String s: nsList) {
             appendIfLiteralAddress(s, sb);
         }
@@ -491,7 +491,7 @@
      *         contained in the provided str.
      */
     private static String createProviderURL(String str) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         StringTokenizer st = new StringTokenizer(str, ",");
         while (st.hasMoreTokens()) {
             appendIfLiteralAddress(st.nextToken(), sb);
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/PolicyTool.java	Wed Dec 10 14:15:31 2014 -0800
+++ b/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/PolicyTool.java	Thu Dec 11 15:23:02 2014 +0800
@@ -980,8 +980,9 @@
                                 grantEntry.principals.listIterator();
             while (list.hasNext()) {
                 PolicyParser.PrincipalEntry pppe = list.next();
-                sb.append(" Principal " + pppe.getDisplayClass() + " " +
-                    pppe.getDisplayName(true));
+                sb.append(" Principal ").append(pppe.getDisplayClass())
+                        .append(' ')
+                        .append(pppe.getDisplayName(true));
                 if (list.hasNext()) sb.append(", ");
             }
             result = sb.toString();