Clean up of SSLContextImpl JDK-8145252-TLS13-branch
authorxuelei
Mon, 11 Jun 2018 07:24:50 -0700
branchJDK-8145252-TLS13-branch
changeset 56734 12e20a7d6e26
parent 56718 da9979451b7a
child 56738 0811eaea3cd4
Clean up of SSLContextImpl
src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java
--- a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java	Sun Jun 10 21:22:05 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java	Mon Jun 11 07:24:50 2018 -0700
@@ -38,7 +38,9 @@
 /**
  * Implementation of an SSLContext.
  *
- * Instances of this class are immutable after the context is initialized.
+ * Implementation note: Instances of this class and the child classes are
+ * immutable, except that the context initialization (SSLContext.init()) may
+ * reset the key, trust managers and source of secure random.
  */
 
 public abstract class SSLContextImpl extends SSLContextSpi {
@@ -411,7 +413,7 @@
             }
         }
 
-        return Arrays.asList(suites.toArray(new CipherSuite[0]));
+        return new ArrayList<>(suites);
     }
 
     /*
@@ -937,10 +939,9 @@
                 }
             } else {
                 // Use the customized TLS protocols.
-                candidates = new ProtocolVersion[refactored.size()];
-                candidates = refactored.toArray(candidates);
+                candidates =
+                    refactored.toArray(new ProtocolVersion[refactored.size()]);
             }
-            System.out.println(refactored.toString());
 
             return getAvailableProtocols(candidates);
         }