hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [10/19] httpcomponents-core git commit: HTTPCORE-462: Deprecate SSLContextBuilder.useProtocol(String) in favor a new method setProtocol(String). Local build OK.
Date Fri, 12 May 2017 08:04:34 GMT
HTTPCORE-462: Deprecate SSLContextBuilder.useProtocol(String) in favor a new method setProtocol(String).
Local build OK.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.4.x@1794107
13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/cbc80fc9
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/cbc80fc9
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/cbc80fc9

Branch: refs/heads/4.4.x
Commit: cbc80fc97ec874a1a09f3d9f91b7a4dd09d49899
Parents: d71bbb2
Author: Gary D. Gregory <ggregory@apache.org>
Authored: Fri May 5 21:17:59 2017 +0000
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Fri May 12 09:49:28 2017 +0200

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |  3 +++
 .../apache/http/benchmark/HttpBenchmark.java    |  2 +-
 .../org/apache/http/ssl/SSLContextBuilder.java  | 22 ++++++++++++++++++++
 .../apache/http/ssl/TestSSLContextBuilder.java  | 12 +++++++++++
 4 files changed, 38 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/cbc80fc9/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index a3c75af..b29e546 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -15,6 +15,9 @@ Changelog
 * HTTPCORE-461: Add factory methods to DefaultHttpServerIODispatch to handle a null SSLContext.
   Contributed by Gary Gregory <ggregory at apache.org>
 
+* HTTPCORE-462: Deprecate SSLContextBuilder.useProtocol(String) in favor a new method setProtocol(String).
+  Contributed by Gary Gregory <ggregory at apache.org>
+
 
 Release 4.4.6
 -------------------

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/cbc80fc9/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
----------------------------------------------------------------------
diff --git a/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java b/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
index a902819..3e15636 100644
--- a/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
+++ b/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
@@ -184,7 +184,7 @@ public class HttpBenchmark {
         SocketFactory socketFactory = null;
         if ("https".equals(host.getSchemeName())) {
             final SSLContextBuilder sslContextBuilder = new SSLContextBuilder();
-            sslContextBuilder.useProtocol("SSL");
+            sslContextBuilder.setProtocol("SSL");
             if (config.isDisableSSLVerification()) {
                 sslContextBuilder.loadTrustMaterial(null, new TrustStrategy() {
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/cbc80fc9/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
index 70ed1f4..20d9eee 100644
--- a/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
+++ b/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
@@ -107,12 +107,34 @@ public class SSLContextBuilder {
      * @see <a href=
      *      "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
      *      Cryptography Architecture Standard Algorithm Name Documentation</a>
+     * @deprecated Use {@link #setProtocol(String)}.
      */
+    @Deprecated
     public SSLContextBuilder useProtocol(final String protocol) {
         this.protocol = protocol;
         return this;
     }
 
+    /**
+     * Sets the SSLContext algorithm name.
+     *
+     * @param protocol
+     *            the SSLContext algorithm name of the requested protocol. See
+     *            the SSLContext section in the <a href=
+     *            "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
+     *            Cryptography Architecture Standard Algorithm Name
+     *            Documentation</a> for more information.
+     * @return this builder
+     * @see <a href=
+     *      "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
+     *      Cryptography Architecture Standard Algorithm Name Documentation</a>
+     * @since 4.4.7
+     */
+    public SSLContextBuilder setProtocol(final String protocol) {
+        this.protocol = protocol;
+        return this;
+    }
+
     public SSLContextBuilder setSecureRandom(final SecureRandom secureRandom) {
         this.secureRandom = secureRandom;
         return this;

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/cbc80fc9/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java b/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
index b789fcf..c33ee11 100644
--- a/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
+++ b/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
@@ -90,6 +90,18 @@ public class TestSSLContextBuilder {
     @Test
     public void testBuildAllNull() throws Exception {
         final SSLContext sslContext = SSLContextBuilder.create()
+                .setProtocol(null)
+                .setSecureRandom(null)
+                .loadTrustMaterial((KeyStore) null, null)
+                .loadKeyMaterial((KeyStore) null, null, null)
+                .build();
+        Assert.assertNotNull(sslContext);
+        Assert.assertEquals("TLS", sslContext.getProtocol());
+    }
+
+    @Test
+    public void testBuildAllNull_deprecated() throws Exception {
+        final SSLContext sslContext = SSLContextBuilder.create()
                 .useProtocol(null)
                 .setSecureRandom(null)
                 .loadTrustMaterial((KeyStore) null, null)


Mime
View raw message