RFR: 8314063 : The socket is not closed in Connection::createSocket when the handshake failed for LDAP connection [v3]

Aleksei Efimov aefimov at openjdk.org
Thu Aug 17 10:56:28 UTC 2023


On Wed, 16 Aug 2023 22:57:55 GMT, Mark Sheppard <msheppar at openjdk.org> wrote:

>> src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java line 369:
>> 
>>> 367:                 }
>>> 368:             }
>>> 369:         } catch (Exception e) {
>> 
>> The code wrapped in this try-catch block can throw unchecked exceptions, for example `SecurityException` thrown by `Socket.connect`. For such cases the newly created socket remain open.
>
> But the catch is on generalized Exception, and SecutityException is a subclass, so it is covered, n'est-ce pas?

Thanks Mark. Correct - SecurityException is a subclass of Exception, scratch my previous comment. We just need to double check `catch Exception` covers all thrown exception types in this code block.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15294#discussion_r1297053493


More information about the core-libs-dev mailing list