summaryrefslogtreecommitdiffstats
path: root/libjava/java/net/ServerSocket.java
diff options
context:
space:
mode:
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-19 15:08:22 +0000
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-19 15:08:22 +0000
commit8db76ca933c641a7b60834003cd77e4ee4b99c49 (patch)
tree79455d0849bdbde550daa14a232718f903499cff /libjava/java/net/ServerSocket.java
parent208f6aa90d7709852c3c07ac158a0f9cc0a410b4 (diff)
downloadppe42-gcc-8db76ca933c641a7b60834003cd77e4ee4b99c49.tar.gz
ppe42-gcc-8db76ca933c641a7b60834003cd77e4ee4b99c49.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68198 138bc75d-0d04-0410-961f-82ee72b054a4
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 2d04eac452f..8dd420bbd3b 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
OpenPOWER on IntegriCloud