From ec539d90649acc85c94892227e41278502f8b28f Mon Sep 17 00:00:00 2001 From: Otavio Goncalves de Santana Date: Thu, 22 May 2014 20:24:42 +0000 Subject: [PATCH] 8043342: Replace uses of StringBuffer with StringBuilder within crypto code JCE components of 8041679 here due to code signing process. Reviewed-by: xuelei, wetmore --- .../classes/com/sun/crypto/provider/DHParameters.java | 10 +++++----- .../classes/com/sun/crypto/provider/DHPublicKey.java | 10 +++++----- .../com/sun/crypto/provider/OAEPParameters.java | 4 ++-- jdk/src/share/classes/sun/security/pkcs11/P11Util.java | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/jdk/src/share/classes/com/sun/crypto/provider/DHParameters.java b/jdk/src/share/classes/com/sun/crypto/provider/DHParameters.java index 57b0e7c3a0c..f8de6b43ff5 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/DHParameters.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/DHParameters.java @@ -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 @@ public final class DHParameters extends AlgorithmParametersSpi { 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(); } } diff --git a/jdk/src/share/classes/com/sun/crypto/provider/DHPublicKey.java b/jdk/src/share/classes/com/sun/crypto/provider/DHPublicKey.java index 7293c945768..037589c8d53 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/DHPublicKey.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/DHPublicKey.java @@ -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 @@ javax.crypto.interfaces.DHPublicKey, Serializable { 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 @@ javax.crypto.interfaces.DHPublicKey, Serializable { + 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 { diff --git a/jdk/src/share/classes/com/sun/crypto/provider/OAEPParameters.java b/jdk/src/share/classes/com/sun/crypto/provider/OAEPParameters.java index 74b3cc408d9..1ea16cc62e1 100644 --- a/jdk/src/share/classes/com/sun/crypto/provider/OAEPParameters.java +++ b/jdk/src/share/classes/com/sun/crypto/provider/OAEPParameters.java @@ -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 @@ public final class OAEPParameters extends AlgorithmParametersSpi { } 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 " + diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11Util.java b/jdk/src/share/classes/sun/security/pkcs11/P11Util.java index 38da9401f33..b5787a712f9 100644 --- a/jdk/src/share/classes/sun/security/pkcs11/P11Util.java +++ b/jdk/src/share/classes/sun/security/pkcs11/P11Util.java @@ -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 @@ public final class P11Util { 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) {