[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-core-libs-dev
Subject:    Integrated: 8325579: Inconsistent behavior in com.sun.jndi.ldap.Connection::createSocket
From:       Christoph Langer <clanger () openjdk ! org>
Date:       2024-03-25 16:34:32
Message-ID: LHz3rMRHwRfSLKgq9MISfEEVMQAiv6Svf7TnwCSjNRw=.cd6a2edd-035e-4702-a686-0cedf7250e87 () github ! com
[Download RAW message or body]

On Fri, 9 Feb 2024 21:29:28 GMT, Christoph Langer <clanger@openjdk.org> wrote:

> During analysing a customer case I figured out that we have an inconsistency \
> between documentation and actual behavior in class com.sun.jndi.ldap.Connection. \
> The [method documentation of \
> com.sun.jndi.ldap.Connection::createSocket](https://github.com/openjdk/jdk/blob/3ebe \
> 6c192a5dd5cc46ae2d263713c9ff38cd46bb/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java#L281) \
> states: "If a timeout is supplied but unconnected sockets are not supported then \
> the timeout is ignored and a connected socket is created." 
> This, however does not happen. If a SocketFactory would not support unconnected \
> sockets, it would likely throw a SocketException in \
> [SocketFactory::createSocket()](https://github.com/openjdk/jdk/blob/6303c0e7136436a2 \
> d3cb6043b88edf788c0067cc/src/java.base/share/classes/javax/net/SocketFactory.java#L123). \
> And since [the code](https://github.com/openjdk/jdk/blob/3ebe6c192a5dd5cc46ae2d26371 \
> 3c9ff38cd46bb/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java#L336) \
> does not check for this behavior, a connection with timeout value through a \
> SocketFactory that does not support unconnected sockets would simply fail with an \
> IOException. 
> So we should either make the code adhere to what is documented or adapt the \
> documentation to the actual behavior. 
> I hereby try to fix the connect coding. Alternatively, we could also adapt the \
> description - I have no strong opinion. What do the experts suggest?

This pull request has now been integrated.

Changeset: 907e30ff
Author:    Christoph Langer <clanger@openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/907e30ff00abd6cd4935987810d282f46ec07704
                
Stats:     245 lines in 3 files changed: 130 ins; 35 del; 80 mod

8325579: Inconsistent behavior in com.sun.jndi.ldap.Connection::createSocket

Reviewed-by: dfuchs, aefimov

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

PR: https://git.openjdk.org/jdk/pull/17797


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic