mirror of
https://github.com/openRuyi-Project/gcc.git
synced 2026-06-16 00:16:04 +00:00
2003-06-17 Michael Koch <konqueror@gmx.de>
* java/net/InetSocketAddress.java (InetSocketAddress): Use wildcard address if addr is null. (InetSocketAddress): Dont duplicate implementation. (InetSocketAddress): Throw exception when hostname is null. * java/net/Socket.java: Reworked imports. (Socket): Throw exception when raddr is null, handle case when laddr is null. From-SVN: r68106
This commit is contained in:
committed by
Michael Koch
parent
6f3aed57fb
commit
7d8f4ff955
@@ -37,7 +37,9 @@ exception statement from your version. */
|
||||
|
||||
package java.net;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.nio.channels.IllegalBlockingModeException;
|
||||
|
||||
@@ -87,8 +89,6 @@ public class Socket
|
||||
|
||||
private boolean closed = false;
|
||||
|
||||
// Constructors
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>Socket</code> object without
|
||||
* connecting to a remote host. This useful for subclasses of socket that
|
||||
@@ -282,6 +282,9 @@ public class Socket
|
||||
{
|
||||
this();
|
||||
|
||||
if (raddr == null)
|
||||
throw new NullPointerException ();
|
||||
|
||||
if (impl == null)
|
||||
throw new IOException("Cannot initialize Socket implementation");
|
||||
|
||||
@@ -289,8 +292,12 @@ public class Socket
|
||||
if (sm != null)
|
||||
sm.checkConnect(raddr.getHostName(), rport);
|
||||
|
||||
// bind/connect socket
|
||||
bind (new InetSocketAddress (laddr, lport));
|
||||
// bind socket
|
||||
SocketAddress bindaddr =
|
||||
laddr == null ? null : new InetSocketAddress (laddr, lport);
|
||||
bind (bindaddr);
|
||||
|
||||
// connect socket
|
||||
connect (new InetSocketAddress (raddr, rport));
|
||||
|
||||
// FIXME: JCL p. 1586 says if localPort is unspecified, bind to any port,
|
||||
|
||||
Reference in New Issue
Block a user