> 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/3ebe6c192a5dd5cc46ae2d263713c9ff38cd46bb/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/6303c0e7136436a2d3cb6043b88edf788c0067cc/src/java.base/share/classes/javax/net/SocketFactory.java#L123).
>  And since [the 
> code](https://github.com/openjdk/jdk/blob/3ebe6c192a5dd5cc46ae2d263713c9ff38cd46bb/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?

Christoph Langer has refreshed the contents of this pull request, and previous 
commits have been removed. The incremental views will show differences compared 
to the previous content of the PR. The pull request contains one new commit 
since the last revision:

  JDK-8325579

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/17797/files
  - new: https://git.openjdk.org/jdk/pull/17797/files/419f96f5..48318eb2

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=17797&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17797&range=00-01

  Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/17797.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17797/head:pull/17797

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

Reply via email to