8214321: Misleading code in SSLCipher
authorxuelei
Mon, 26 Nov 2018 20:50:21 -0800
changeset 52690 cecba555360c
parent 52689 7084dae775f2
child 52691 d9f6a700fec9
child 52756 0d757a37896c
8214321: Misleading code in SSLCipher Reviewed-by: ascarpino
src/java.base/share/classes/sun/security/ssl/SSLCipher.java
--- a/src/java.base/share/classes/sun/security/ssl/SSLCipher.java	Tue Nov 27 08:51:20 2018 +0800
+++ b/src/java.base/share/classes/sun/security/ssl/SSLCipher.java	Mon Nov 26 20:50:21 2018 -0800
@@ -530,22 +530,22 @@
             ProtocolVersion protocolVersion,
             SecretKey key, IvParameterSpec iv,
             SecureRandom random) throws GeneralSecurityException {
-        if (readCipherGenerators.length == 0) {
+        if (writeCipherGenerators.length == 0) {
             return null;
         }
 
-        WriteCipherGenerator rcg = null;
+        WriteCipherGenerator wcg = null;
         for (Map.Entry<WriteCipherGenerator,
                 ProtocolVersion[]> me : writeCipherGenerators) {
             for (ProtocolVersion pv : me.getValue()) {
                 if (protocolVersion == pv) {
-                    rcg = me.getKey();
+                    wcg = me.getKey();
                 }
             }
         }
 
-        if (rcg != null) {
-            return rcg.createCipher(this, authenticator,
+        if (wcg != null) {
+            return wcg.createCipher(this, authenticator,
                     protocolVersion, transformation, key, iv, random);
         }
         return null;