I see. Everything is OK now.

On Feb 23, 2009, at 1:46 PM, Xuelei Fan wrote:

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[1], which looks like:

   * @param host the server host name with which to connect, or
   *        <code>null</code> for the loopback address.

[1]: src/share/classes/javax/net/SocketFactory.java

Thanks,
Andrew
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



Reply via email to