8043342: Replace uses of StringBuffer with StringBuilder within crypto code
authorwetmore
Thu, 22 May 2014 20:24:42 +0000
changeset 24578 bbf15045dfbb
parent 24514 2440b44952d7
child 24579 cc32ec7a4083
8043342: Replace uses of StringBuffer with StringBuilder within crypto code Summary: JCE components of 8041679 here due to code signing process. Reviewed-by: xuelei, wetmore Contributed-by: otaviopolianasantana@gmail.com
jdk/src/share/classes/com/sun/crypto/provider/DHParameters.java
jdk/src/share/classes/com/sun/crypto/provider/DHPublicKey.java
jdk/src/share/classes/com/sun/crypto/provider/OAEPParameters.java
jdk/src/share/classes/sun/security/pkcs11/P11Util.java
--- a/jdk/src/share/classes/com/sun/crypto/provider/DHParameters.java	Thu May 22 13:03:10 2014 -0700
+++ b/jdk/src/share/classes/com/sun/crypto/provider/DHParameters.java	Thu May 22 20:24:42 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -131,14 +131,14 @@
     protected String engineToString() {
         String LINE_SEP = System.getProperty("line.separator");
 
-        StringBuffer strbuf
-            = new StringBuffer("SunJCE Diffie-Hellman Parameters:"
+        StringBuilder sb
+            = new StringBuilder("SunJCE Diffie-Hellman Parameters:"
                                + LINE_SEP + "p:" + LINE_SEP
                                + Debug.toHexString(this.p)
                                + LINE_SEP + "g:" + LINE_SEP
                                + Debug.toHexString(this.g));
         if (this.l != 0)
-            strbuf.append(LINE_SEP + "l:" + LINE_SEP + "    " + this.l);
-        return strbuf.toString();
+            sb.append(LINE_SEP + "l:" + LINE_SEP + "    " + this.l);
+        return sb.toString();
     }
 }
--- a/jdk/src/share/classes/com/sun/crypto/provider/DHPublicKey.java	Thu May 22 13:03:10 2014 -0700
+++ b/jdk/src/share/classes/com/sun/crypto/provider/DHPublicKey.java	Thu May 22 20:24:42 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -260,8 +260,8 @@
     public String toString() {
         String LINE_SEP = System.getProperty("line.separator");
 
-        StringBuffer strbuf
-            = new StringBuffer("SunJCE Diffie-Hellman Public Key:"
+        StringBuilder sb
+            = new StringBuilder("SunJCE Diffie-Hellman Public Key:"
                                + LINE_SEP + "y:" + LINE_SEP
                                + Debug.toHexString(this.y)
                                + LINE_SEP + "p:" + LINE_SEP
@@ -269,8 +269,8 @@
                                + LINE_SEP + "g:" + LINE_SEP
                                + Debug.toHexString(this.g));
         if (this.l != 0)
-            strbuf.append(LINE_SEP + "l:" + LINE_SEP + "    " + this.l);
-        return strbuf.toString();
+            sb.append(LINE_SEP + "l:" + LINE_SEP + "    " + this.l);
+        return sb.toString();
     }
 
     private void parseKeyBits() throws InvalidKeyException {
--- a/jdk/src/share/classes/com/sun/crypto/provider/OAEPParameters.java	Thu May 22 13:03:10 2014 -0700
+++ b/jdk/src/share/classes/com/sun/crypto/provider/OAEPParameters.java	Thu May 22 20:24:42 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -238,7 +238,7 @@
     }
 
     protected String engineToString() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("MD: " + mdName + "\n");
         sb.append("MGF: MGF1" + mgfSpec.getDigestAlgorithm() + "\n");
         sb.append("PSource: PSpecified " +
--- a/jdk/src/share/classes/sun/security/pkcs11/P11Util.java	Thu May 22 13:03:10 2014 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11Util.java	Thu May 22 20:24:42 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -166,7 +166,7 @@
         if (b == null) {
             return "(null)";
         }
-        StringBuffer sb = new StringBuffer(b.length * 3);
+        StringBuilder sb = new StringBuilder(b.length * 3);
         for (int i = 0; i < b.length; i++) {
             int k = b[i] & 0xff;
             if (i != 0) {