Hi,
I committed the attached patch.
Regards,
Jeroen
2007-03-19 Jeroen Frijters <[EMAIL PROTECTED]>
* java/net/Socket.java
(implCreated): New field.
(getImpl): Call impl.create() if it hasn't been called yet.
(bind): Removed explicit impl.create() call.
Index: Socket.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/Socket.java,v
retrieving revision 1.61
diff -u -r1.61 Socket.java
--- Socket.java 12 Feb 2007 18:56:48 -0000 1.61
+++ Socket.java 5 Mar 2007 14:12:35 -0000
@@ -83,6 +83,11 @@
SocketImpl impl;
/**
+ * True if impl.create() has been called.
+ */
+ private boolean implCreated;
+
+ /**
* True if the socket is bound.
* Package private so it can be set from ServerSocket when accept is called.
*/
@@ -326,6 +331,18 @@
private SocketImpl getImpl() throws SocketException
{
+ if (! implCreated)
+ {
+ try
+ {
+ impl.create(true);
+ }
+ catch (IOException x)
+ {
+ throw (SocketException) new SocketException().initCause(x);
+ }
+ implCreated = true;
+ }
return impl;
}
@@ -359,7 +376,6 @@
// bind to address/port
try
{
- getImpl().create(true);
getImpl().bind(tmp.getAddress(), tmp.getPort());
bound = true;
}