Commit 40b86e5f by Tom Tromey Committed by Tom Tromey

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
parent e8c30b5f
2007-02-12 Tom Tromey <tromey@redhat.com>
* 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.
2007-02-09 Jakub Jelinek <jakub@redhat.com> 2007-02-09 Jakub Jelinek <jakub@redhat.com>
* java/util/VMTimeZone.java: Rewrite to handle both the old * java/util/VMTimeZone.java: Rewrite to handle both the old
......
2007-02-12 Tom Tromey <tromey@redhat.com>
* java/util/Collections.java (UnmodifiableMap.toArray): Imported
changes from Classpath.
2007-02-09 Gary Benson <gbenson@redhat.com> 2007-02-09 Gary Benson <gbenson@redhat.com>
* javax/management/ObjectName.java * javax/management/ObjectName.java
......
...@@ -5115,7 +5115,7 @@ public class Collections ...@@ -5115,7 +5115,7 @@ public class Collections
// Map.Entry // Map.Entry
public Map.Entry<K,V>[] toArray() public Map.Entry<K,V>[] toArray()
{ {
Map.Entry<K,V>[] mapEntryResult = (Map.Entry<K,V>[]) super.toArray(); Object[] mapEntryResult = super.toArray();
UnmodifiableMapEntry<K,V> result[] = null; UnmodifiableMapEntry<K,V> result[] = null;
if (mapEntryResult != null) if (mapEntryResult != null)
...@@ -5123,21 +5123,21 @@ public class Collections ...@@ -5123,21 +5123,21 @@ public class Collections
result = (UnmodifiableMapEntry<K,V>[]) result = (UnmodifiableMapEntry<K,V>[])
new UnmodifiableMapEntry[mapEntryResult.length]; new UnmodifiableMapEntry[mapEntryResult.length];
for (int i = 0; i < mapEntryResult.length; ++i) for (int i = 0; i < mapEntryResult.length; ++i)
result[i] = new UnmodifiableMapEntry(mapEntryResult[i]); result[i] = new UnmodifiableMapEntry<K,V>((Map.Entry<K,V>)mapEntryResult[i]);
} }
return result; return result;
} }
// The array returned is an array of UnmodifiableMapEntry instead of // The array returned is an array of UnmodifiableMapEntry instead of
// Map.Entry // Map.Entry
public Map.Entry<K,V>[] toArray(Map.Entry<K,V>[] array) public <S> S[] toArray(S[] array)
{ {
super.toArray(array); S[] result = super.toArray(array);
if (array != null) if (result != null)
for (int i = 0; i < array.length; i++) for (int i = 0; i < result.length; i++)
array[i] = array[i] =
new UnmodifiableMapEntry<K,V>(array[i]); (S) new UnmodifiableMapEntry<K,V>((Map.Entry<K,V>) result[i]);
return array; return array;
} }
......
/* PlainDatagramSocketImpl.java -- Default DatagramSocket implementation /* 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. This file is part of GNU Classpath.
...@@ -119,7 +119,7 @@ public final class PlainDatagramSocketImpl extends DatagramSocketImpl ...@@ -119,7 +119,7 @@ public final class PlainDatagramSocketImpl extends DatagramSocketImpl
/** /**
* Default do nothing constructor * Default do nothing constructor
*/ */
public PlainDatagramSocketImpl() public PlainDatagramSocketImpl() throws IOException
{ {
} }
......
/* PlainSocketImpl.java -- Default socket implementation /* 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. Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -110,6 +110,9 @@ public final class PlainSocketImpl extends SocketImpl ...@@ -110,6 +110,9 @@ public final class PlainSocketImpl extends SocketImpl
// localAddress cache // localAddress cache
InetAddress localAddress; InetAddress localAddress;
// Local address as an InetSocketAddress.
InetSocketAddress localSocketAddress;
/** /**
* A cached copy of the in stream for reading from the socket. * A cached copy of the in stream for reading from the socket.
*/ */
...@@ -325,6 +328,24 @@ public final class PlainSocketImpl extends SocketImpl ...@@ -325,6 +328,24 @@ public final class PlainSocketImpl extends SocketImpl
protected native void sendUrgentData(int data) throws IOException; 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 * Returns an InputStream object for reading from this socket. This will
* be an instance of SocketInputStream. * be an instance of SocketInputStream.
......
/* 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. This file is part of libgcj.
...@@ -364,7 +364,7 @@ gnu::java::net::PlainSocketImpl$SocketOutputStream::write(jbyteArray b, jint off ...@@ -364,7 +364,7 @@ gnu::java::net::PlainSocketImpl$SocketOutputStream::write(jbyteArray b, jint off
if (offset < 0 || len < 0 || offset + len > JvGetArrayLength (b)) if (offset < 0 || len < 0 || offset + len > JvGetArrayLength (b))
throw new ::java::lang::ArrayIndexOutOfBoundsException; 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 static void
...@@ -435,8 +435,7 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer, ...@@ -435,8 +435,7 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer,
if (offset < 0 || count < 0 || offset + count > bsize) if (offset < 0 || count < 0 || offset + count > bsize)
throw new ::java::lang::ArrayIndexOutOfBoundsException; throw new ::java::lang::ArrayIndexOutOfBoundsException;
return read_helper (this$0, return read_helper (this$0, elements (buffer) + offset, count);
elements (buffer) + offset * sizeof (jbyte), count);
} }
static jint static jint
......
...@@ -4905,7 +4905,7 @@ classpath/java/net/ConnectException.java \ ...@@ -4905,7 +4905,7 @@ classpath/java/net/ConnectException.java \
classpath/java/net/ContentHandler.java \ classpath/java/net/ContentHandler.java \
classpath/java/net/ContentHandlerFactory.java \ classpath/java/net/ContentHandlerFactory.java \
classpath/java/net/DatagramPacket.java \ classpath/java/net/DatagramPacket.java \
java/net/DatagramSocket.java \ classpath/java/net/DatagramSocket.java \
classpath/java/net/DatagramSocketImpl.java \ classpath/java/net/DatagramSocketImpl.java \
classpath/java/net/DatagramSocketImplFactory.java \ classpath/java/net/DatagramSocketImplFactory.java \
classpath/java/net/FileNameMap.java \ classpath/java/net/FileNameMap.java \
...@@ -4928,7 +4928,7 @@ classpath/java/net/Proxy.java \ ...@@ -4928,7 +4928,7 @@ classpath/java/net/Proxy.java \
classpath/java/net/ProxySelector.java \ classpath/java/net/ProxySelector.java \
classpath/java/net/ResolverCache.java \ classpath/java/net/ResolverCache.java \
classpath/java/net/ServerSocket.java \ classpath/java/net/ServerSocket.java \
java/net/Socket.java \ classpath/java/net/Socket.java \
classpath/java/net/SocketAddress.java \ classpath/java/net/SocketAddress.java \
classpath/java/net/SocketException.java \ classpath/java/net/SocketException.java \
classpath/java/net/SocketImpl.java \ classpath/java/net/SocketImpl.java \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment