[security-dev 00602]: Re: code review request: 5067458 Loopback SSLSocketImpl createSocket is throwing an exception.
Xuelei.Fan at Sun.COM
Sun Feb 22 21:46:05 PST 2009
Max (Weijun) Wang wrote:
> Fix looks fine.
> BTW, SSLSocketFactory has another method
> createSocket(Socket s, String host,
> int port, boolean autoClose)
> How does it behave?
Because there is a "Socket" parameter, so no new connection will be
established. The "host" parameter will only be used for hostname checking.
> and, will you clarify its javadoc on the host argument?
The jdk 7 has already updated the javadoc, which looks like:
* @param host the server host name with which to connect, or
* <code>null</code> for the loopback address.
> On Feb 23, 2009, at 1:07 PM, Xuelei Fan wrote:
>> I need to get a code review for:
>> 5067458 Loopback SSLSocketImpl createSocket is throwing an exception.
>> The bug description:
>> i'm attaching an example. in essence, i do this:
>> SocketFactory f = SocketFactory.getDefault();
>> Socket s = f.createSocket( (String)null, 8080 );
>> and i create a loopback socket, as per the spec for java.net.Socket.
>> the createSocket() call throws an exception, but it's an
>> IOException which indicates "Connection refused" because i don't
>> have anything listening on that socket. no problem there. however,
>> then i do this:
>> SSLSocketFactory f =
>> SSLSocket s = (SSLSocket)f.createSocket( (String)null,
>> 8080 );
>> and i get an IllegalArgumentException from java.net.InetSocketAddress
>> saying that an InetSocketAddress can't be created with a null
>> hostname. since SSLSocket extends socket, and the spec doesn't
>> mention any change in behavior, i would expect to get the same
>> loopback behavior and another "Connection refused" exception.
More information about the security-dev