aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/net/ServerSocket.java
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2003-06-19 15:08:22 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2003-06-19 15:08:22 +0000
commita05f6447e30beccc4271606dff8dc1138a6b9a72 (patch)
tree79455d0849bdbde550daa14a232718f903499cff /libjava/java/net/ServerSocket.java
parent3580a7d58578ad416172c22400df81b1702c47ae (diff)
downloadgcc-a05f6447e30beccc4271606dff8dc1138a6b9a72.zip
gcc-a05f6447e30beccc4271606dff8dc1138a6b9a72.tar.gz
gcc-a05f6447e30beccc4271606dff8dc1138a6b9a72.tar.bz2
HttpURLConnection.java, [...]: Reworked import statements.
2003-06-19 Michael Koch <konqueror@gmx.de> * java/net/HttpURLConnection.java, java/net/Inet4Address.java, java/net/Inet6Address.java, java/net/SocketImpl.java, java/net/URLClassLoader.java: Reworked import statements. * java/net/InetAddress.java (getByAddress): Simplified. * java/net/ServerSocket.java (ServerSocket): Moved special handling during bind operation to bind(). (bind): Handle different cases when trying to bind a socket. * java/net/URLConnection.java (getHeaderFieldDate): Merged with classpath. (getHeaderFieldInt): Likewise. From-SVN: r68198
Diffstat (limited to 'libjava/java/net/ServerSocket.java')
-rw-r--r--libjava/java/net/ServerSocket.java89
1 files changed, 41 insertions, 48 deletions
diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java
index 2d04eac..8dd420b 100644
--- a/libjava/java/net/ServerSocket.java
+++ b/libjava/java/net/ServerSocket.java
@@ -157,57 +157,11 @@ public class ServerSocket
if (impl == null)
throw new IOException("Cannot initialize Socket implementation");
- SecurityManager s = System.getSecurityManager();
- if (s != null)
- s.checkListen(port);
-
- if (bindAddr == null)
- bindAddr = InetAddress.ANY_IF;
-
// create socket
impl.create(true);
- // bind to address/port
- try
- {
- impl.bind(bindAddr, port);
- }
- catch (IOException exception)
- {
- impl.close();
- throw exception;
- }
- catch (RuntimeException exception)
- {
- impl.close();
- throw exception;
- }
- catch (Error error)
- {
- impl.close();
- throw error;
- }
-
- // listen on socket
- try
- {
- impl.listen(backlog);
- }
- catch (IOException exception)
- {
- impl.close();
- throw exception;
- }
- catch (RuntimeException exception)
- {
- impl.close();
- throw exception;
- }
- catch (Error error)
- {
- impl.close();
- throw error;
- }
+ // bind/listen socket
+ bind (new InetSocketAddress (bindAddr, port), backlog);
}
/**
@@ -258,9 +212,48 @@ public class ServerSocket
if (s != null)
s.checkListen (tmp.getPort ());
+ // bind to address/port
+ try
+ {
impl.bind (tmp.getAddress (), tmp.getPort ());
+ }
+ catch (IOException exception)
+ {
+ impl.close();
+ throw exception;
+ }
+ catch (RuntimeException exception)
+ {
+ impl.close();
+ throw exception;
+ }
+ catch (Error error)
+ {
+ impl.close();
+ throw error;
+ }
+
+ // listen on socket
+ try
+ {
impl.listen(backlog);
}
+ catch (IOException exception)
+ {
+ impl.close();
+ throw exception;
+ }
+ catch (RuntimeException exception)
+ {
+ impl.close();
+ throw exception;
+ }
+ catch (Error error)
+ {
+ impl.close();
+ throw error;
+ }
+ }
/**
* This method returns the local address to which this socket is bound