< prev index next >

src/java.net.http/share/classes/jdk/internal/net/http/ConnectionPool.java

Print this page
rev 54081 : 8265099: Revert backport to 11u of 8236859: WebSocket over authenticating proxy fails with NPE
Summary: Revert https://hg.openjdk.java.net/jdk-updates/jdk11u-dev/rev/57e3fa3574ec
Reviewed-by:

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -140,11 +140,10 @@
         if (stopped) return null;
         CacheKey key = new CacheKey(addr, proxy);
         HttpConnection c = secure ? findConnection(key, sslPool)
                                   : findConnection(key, plainPool);
         //System.out.println ("getConnection returning: " + c);
-        assert c == null || c.isSecure() == secure;
         return c;
     }
 
     /**
      * Returns the connection to the pool.

@@ -154,14 +153,10 @@
     }
 
     // Called also by whitebox tests
     void returnToPool(HttpConnection conn, Instant now, long keepAlive) {
 
-        assert (conn instanceof PlainHttpConnection) || conn.isSecure()
-            : "Attempting to return unsecure connection to SSL pool: "
-                + conn.getClass();
-
         // Don't call registerCleanupTrigger while holding a lock,
         // but register it before the connection is added to the pool,
         // since we don't want to trigger the cleanup if the connection
         // is not in the pool.
         CleanupTrigger cleanup = registerCleanupTrigger(conn);

@@ -453,11 +448,11 @@
     private void removeFromPool(HttpConnection c) {
         assert Thread.holdsLock(this);
         if (c instanceof PlainHttpConnection) {
             removeFromPool(c, plainPool);
         } else {
-            assert c.isSecure() : "connection " + c + " is not secure!";
+            assert c.isSecure();
             removeFromPool(c, sslPool);
         }
     }
 
     // Used by tests
< prev index next >