RFR: 8314063 : The socket is not closed in Connection::createSocket when the handshake failed for LDAP connection [v3]
Mark Sheppard
msheppar at openjdk.org
Wed Aug 16 23:11:14 UTC 2023
On Wed, 16 Aug 2023 17:24:57 GMT, Aleksei Efimov <aefimov at openjdk.org> wrote:
>> Weibing Xiao has updated the pull request incrementally with one additional commit since the last revision:
>>
>> updated the code according to the review
>
> src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java line 372:
>
>> 370: // 8314063 the socket is not closed after the failure of handshake
>> 371: if (socket != null && !socket.isClosed()) {
>> 372: socket.close();
>
> The original exception can be lost if `socket.close()` fails with `IOException` here
a closeConnectionSocket (IIRC) was introduced in previous change which handled any IOExceptions on the close. This could be used here.
But some how that seems to have been renamed !!
709 private void closeOpenedSocket() {
710 try {
711 sock.close();
712 } catch (IOException ioEx) {
713 if (debug) {
714 System.err.println("Connection.closeConnectionSocket: Socket close problem: " + ioEx);
715 System.err.println("Socket isClosed: " + sock.isClosed());
716 }
717 }
718 }
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15294#discussion_r1296519158
More information about the core-libs-dev
mailing list