Fix looks fine.
BTW, SSLSocketFactory has another method
createSocket(Socket s, String host,
int port, boolean autoClose)
How does it behave? and, will you clarify its javadoc on the host
argument?
Max
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.
http://cr.openjdk.java.net/~xuelei/5067458/webrev.00/ <http://cr.openjdk.java.net/%7Exuelei/5067458/webrev.00/
>
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 =
(SSLSocketFactory)SSLSocketFactory.getDefault();
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.
Thanks,
Xuelei