RFR: 8313657 : com.sun.jndi.ldap.Connection.cleanup does not close connections on SocketTimeoutErrors [v5]

Aleksei Efimov aefimov at openjdk.org
Fri Aug 11 19:08:30 UTC 2023


On Wed, 9 Aug 2023 12:52:35 GMT, Weibing Xiao <duke at openjdk.org> wrote:

>> com.sun.jndi.ldap.Connection::leanup does not close the underlying socket if the is an IOException generation when the output stream was flushing the buffer.
>> 
>> Please refer to the bug https://bugs.openjdk.org/browse/JDK-8313657.
>
> Weibing Xiao has updated the pull request incrementally with one additional commit since the last revision:
> 
>   class access modifier

test/jdk/com/sun/jndi/ldap/SocketCloseTest.java line 116:

> 114: 
> 115:     private static class LdapInputStream extends InputStream {
> 116:         private LdapOutputStream los;

The `LdapOutputStream` reference is not used by `LdapInputStream`, therefore the `los` field can be removed:

private static class LdapInputStream extends InputStream {
-        private LdapOutputStream los;
         private ByteArrayInputStream bos;
 
-        public LdapInputStream(LdapOutputStream los) {
-            this.los = los;
+        public LdapInputStream() {
         }
 
         @Override
@@ -144,7 +142,7 @@ public class SocketCloseTest {
     private static class CustomSocket extends Socket {
         private int closeMethodCalled = 0;
         private LdapOutputStream output = new LdapOutputStream();
-        private LdapInputStream input = new LdapInputStream(output);
+        private LdapInputStream input = new LdapInputStream();
 
         public void connect(SocketAddress address, int timeout) {
         }

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15143#discussion_r1291679154


More information about the core-libs-dev mailing list