diff options
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/net/DatagramSocket.java | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java index e21ea44..57f3da7 100644 --- a/libjava/java/net/DatagramSocket.java +++ b/libjava/java/net/DatagramSocket.java @@ -174,11 +174,28 @@ public class DatagramSocket } impl.create(); - - impl.bind(port, laddr == null ? InetAddress.ANY_IF : laddr); + if (laddr == null) + laddr = InetAddress.ANY_IF; - remoteAddress = null; - remotePort = -1; + try + { + impl.bind (port, laddr); + } + catch (SocketException exception) + { + impl.close (); + throw exception; + } + catch (RuntimeException exception) + { + impl.close (); + throw exception; + } + catch (Error error) + { + impl.close (); + throw error; + } } /** |