diff options
author | Brian Jones <cbj@gnu.org> | 2001-11-27 03:12:02 +0000 |
---|---|---|
committer | Brian Jones <cbj@gnu.org> | 2001-11-27 03:12:02 +0000 |
commit | a14894f3ee7860317bd2e5d1d74e9641c49cc91f (patch) | |
tree | 877ab1617391bbf0113b7b760a5d46e692e6718f /java/net/DatagramSocket.java | |
parent | 6854e6e4f28dc92862b411684a932f92dc3f98aa (diff) | |
download | classpath-a14894f3ee7860317bd2e5d1d74e9641c49cc91f.tar.gz |
* java/net/DatagramSocket (getLocalAddress): return local address
used in creating socket instead of calling a native method to retrieve
a value that cannot be changed (fixes Mauve regression).
* native/jni/classpath/jcl.h: #include <config.h> for definition
of DEBUG
* native/jni/java-net/java_net_PlainDatagramSocketImpl.c: Added
more checks for exceptions thrown from use of JNI functions to all
methods (fixes Mauve regression).
Debug messages cleaned up.
* native/jni/java-net/javanet.c: ditto
* native/jni/java-io/javaio.c: _javaio_ThrowException changed to
JCL_ThrowException
* mauve-classpath: updated and can be used with ORP (158 of 1943 tests
fail)
Diffstat (limited to 'java/net/DatagramSocket.java')
-rw-r--r-- | java/net/DatagramSocket.java | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/java/net/DatagramSocket.java b/java/net/DatagramSocket.java index c7058cb1d..5e3a73412 100644 --- a/java/net/DatagramSocket.java +++ b/java/net/DatagramSocket.java @@ -54,6 +54,11 @@ public class DatagramSocket DatagramSocketImpl impl; /** + * This is the local address which cannot be changed + */ + private InetAddress local_addr; + +/** * This is the address we are "connected" to */ private InetAddress remote_addr; @@ -133,6 +138,7 @@ DatagramSocket(int port, InetAddress addr) throws SocketException if (addr == null) addr = InetAddress.getInaddrAny(); + local_addr = addr; impl.localPort = port; impl.bind(port, addr); @@ -195,16 +201,6 @@ getLocalAddress() if (impl == null) return(null); - InetAddress addr = null; - try - { - addr = (InetAddress)impl.getOption(SocketOptions.SO_BINDADDR); - } - catch(SocketException e) - { - return(null); - } - // FIXME: According to libgcj, checkConnect() is supposed to be called // before performing this operation. Problems: 1) We don't have the // addr until after we do it, so we do a post check. 2). The docs I @@ -212,9 +208,9 @@ getLocalAddress() // we'll assume they mean both. SecurityManager sm = System.getSecurityManager(); if (sm != null) - sm.checkConnect(addr.getHostName(), getLocalPort()); + sm.checkConnect(local_addr.getHostName(), getLocalPort()); - return(addr); + return(local_addr); } /*************************************************************************/ |