diff options
author | Tom Tromey <tromey@redhat.com> | 2007-02-12 23:52:39 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2007-02-12 23:52:39 +0000 |
commit | 40b86e5f2cf069832e23043992dedb0bf8e0dcd6 (patch) | |
tree | e330b8e9a136b5340488dc4c338504cc6b870e5b /libjava/gnu/java | |
parent | e8c30b5f9a11fed775dddf8c15706ae251fdd2d5 (diff) | |
download | gcc-40b86e5f2cf069832e23043992dedb0bf8e0dcd6.zip gcc-40b86e5f2cf069832e23043992dedb0bf8e0dcd6.tar.gz gcc-40b86e5f2cf069832e23043992dedb0bf8e0dcd6.tar.bz2 |
Collections.java (UnmodifiableMap.toArray): Imported changes from Classpath.
libjava/classpath
* java/util/Collections.java (UnmodifiableMap.toArray): Imported
changes from Classpath.
libjava
* sources.am, Makefile.in: Rebuilt.
* java/lang/Socket.java: Removed override.
* java/lang/DatagramSocket.java: Removed override.
* gnu/java/net/PlainSocketImpl.java (localSocketAddress): New
field.
(getLocalAddress): New method.
* gnu/java/net/PlainDatagramSocketImpl.java
(PlainDatagramSocketImpl): Throws IOException.
* gnu/java/net/natPlainSocketImplPosix.cc (write): Remove
'sizeof'.
(read): Likewise.
From-SVN: r121866
Diffstat (limited to 'libjava/gnu/java')
-rw-r--r-- | libjava/gnu/java/net/PlainDatagramSocketImpl.java | 4 | ||||
-rw-r--r-- | libjava/gnu/java/net/PlainSocketImpl.java | 23 | ||||
-rw-r--r-- | libjava/gnu/java/net/natPlainSocketImplPosix.cc | 7 |
3 files changed, 27 insertions, 7 deletions
diff --git a/libjava/gnu/java/net/PlainDatagramSocketImpl.java b/libjava/gnu/java/net/PlainDatagramSocketImpl.java index f72d573..08c1cb3 100644 --- a/libjava/gnu/java/net/PlainDatagramSocketImpl.java +++ b/libjava/gnu/java/net/PlainDatagramSocketImpl.java @@ -1,5 +1,5 @@ /* PlainDatagramSocketImpl.java -- Default DatagramSocket implementation - Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -119,7 +119,7 @@ public final class PlainDatagramSocketImpl extends DatagramSocketImpl /** * Default do nothing constructor */ - public PlainDatagramSocketImpl() + public PlainDatagramSocketImpl() throws IOException { } diff --git a/libjava/gnu/java/net/PlainSocketImpl.java b/libjava/gnu/java/net/PlainSocketImpl.java index eefee10..dad1724 100644 --- a/libjava/gnu/java/net/PlainSocketImpl.java +++ b/libjava/gnu/java/net/PlainSocketImpl.java @@ -1,5 +1,5 @@ /* PlainSocketImpl.java -- Default socket implementation - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -110,6 +110,9 @@ public final class PlainSocketImpl extends SocketImpl // localAddress cache InetAddress localAddress; + // Local address as an InetSocketAddress. + InetSocketAddress localSocketAddress; + /** * A cached copy of the in stream for reading from the socket. */ @@ -325,6 +328,24 @@ public final class PlainSocketImpl extends SocketImpl protected native void sendUrgentData(int data) throws IOException; + public synchronized InetSocketAddress getLocalAddress() + { + if (localSocketAddress == null) + { + try + { + localSocketAddress + = new InetSocketAddress ((InetAddress) getOption(SocketOptions.SO_BINDADDR), + localport); + } + catch (SocketException _) + { + return null; + } + } + return localSocketAddress; + } + /** * Returns an InputStream object for reading from this socket. This will * be an instance of SocketInputStream. diff --git a/libjava/gnu/java/net/natPlainSocketImplPosix.cc b/libjava/gnu/java/net/natPlainSocketImplPosix.cc index e4572fa..9fc6196 100644 --- a/libjava/gnu/java/net/natPlainSocketImplPosix.cc +++ b/libjava/gnu/java/net/natPlainSocketImplPosix.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation +/* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation This file is part of libgcj. @@ -364,7 +364,7 @@ gnu::java::net::PlainSocketImpl$SocketOutputStream::write(jbyteArray b, jint off if (offset < 0 || len < 0 || offset + len > JvGetArrayLength (b)) throw new ::java::lang::ArrayIndexOutOfBoundsException; - write_helper (this$0->native_fd, elements (b) + offset * sizeof (jbyte), len); + write_helper (this$0->native_fd, elements (b) + offset, len); } static void @@ -435,8 +435,7 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer, if (offset < 0 || count < 0 || offset + count > bsize) throw new ::java::lang::ArrayIndexOutOfBoundsException; - return read_helper (this$0, - elements (buffer) + offset * sizeof (jbyte), count); + return read_helper (this$0, elements (buffer) + offset, count); } static jint |