http-client-branch: Fixed problem in last push in Response.java http-client-branch
authormichaelm
Wed, 14 Feb 2018 17:02:56 +0000
branchhttp-client-branch
changeset 56127 e2a780d8c6f0
parent 56126 86e628130926
child 56128 249a863b0aca
http-client-branch: Fixed problem in last push in Response.java
src/java.net.http/share/classes/jdk/internal/net/http/Response.java
--- a/src/java.net.http/share/classes/jdk/internal/net/http/Response.java	Wed Feb 14 16:04:18 2018 +0000
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/Response.java	Wed Feb 14 17:02:56 2018 +0000
@@ -69,20 +69,25 @@
         this.version = version;
         this.exchange = exchange;
         this.statusCode = statusCode;
-        InetSocketAddress a;
-        try {
-            a = (InetSocketAddress)connection.channel().getLocalAddress();
-        } catch (IOException e) {
-            a = null;
-        }
-        this.localAddress = a;
         this.isConnectResponse = isConnectResponse;
-        if (connection != null && connection instanceof AbstractAsyncSSLConnection) {
-            AbstractAsyncSSLConnection cc = (AbstractAsyncSSLConnection)connection;
-            SSLEngine engine = cc.getEngine();
-            sslSession = Utils.immutableSession(engine.getSession());
+        if (connection != null) {
+            InetSocketAddress a;
+            try {
+                a = (InetSocketAddress)connection.channel().getLocalAddress();
+            } catch (IOException e) {
+                a = null;
+            }
+            this.localAddress = a;
+            if (connection instanceof AbstractAsyncSSLConnection) {
+                AbstractAsyncSSLConnection cc = (AbstractAsyncSSLConnection)connection;
+                SSLEngine engine = cc.getEngine();
+                sslSession = Utils.immutableSession(engine.getSession());
+            } else {
+                sslSession = null;
+            }
         } else {
             sslSession = null;
+            localAddress = null;
         }
     }