Sorry. I forgot to attach the patch.

> This bug fix had long been effective in Kaffe before, but it was lost
> when Kaffe changed its source tree and reimported Classpath files.
> 
> Please see http://www.kaffe.org/pipermail/kaffe/2004-April/097647.html

ChangeLog:
2006-08-30  Ito Kazumitsu  <[EMAIL PROTECTED]>

        Fixes bug #28867
        Originally in Kaffe: 2004-04-16  Helmer Kraemer <[EMAIL PROTECTED]>
        * java/net/ServerSocket.java(implAccept): Deleted socket.implCreated.
        * java/net/Socket.java: Avoid creating a redundant file descriptor.
        (implCreated): Deleted, (getImpl): Don't check impleCreated,
        (bind): Call getImpl().create(true).

Index: classpath/java/net/ServerSocket.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/ServerSocket.java,v
retrieving revision 1.44
diff -u -r1.44 ServerSocket.java
--- classpath/java/net/ServerSocket.java        15 Jan 2006 03:13:39 -0000      
1.44
+++ classpath/java/net/ServerSocket.java        29 Aug 2006 21:40:55 -0000
@@ -367,7 +367,6 @@
       throw new IllegalBlockingModeException();
 
     impl.accept(socket.impl);
-    socket.implCreated = true;
     socket.bound = true;
   }
 
Index: classpath/java/net/Socket.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/Socket.java,v
retrieving revision 1.55
diff -u -r1.55 Socket.java
--- classpath/java/net/Socket.java      27 Dec 2005 02:18:37 -0000      1.55
+++ classpath/java/net/Socket.java      29 Aug 2006 21:40:55 -0000
@@ -83,13 +83,6 @@
   SocketImpl impl;
 
   /**
-   * True if socket implementation was created by calling their
-   * create() method.
-   */
-  // package-private because ServerSocket.implAccept() needs to access it.
-  boolean implCreated;
-
-  /**
    * True if the socket is bound.
    * Package private so it can be set from ServerSocket when accept is called.
    */
@@ -315,21 +308,6 @@
 
   private SocketImpl getImpl() throws SocketException
   {
-    try
-      {
-       if (! implCreated)
-         {
-           impl.create(true);
-           implCreated = true;
-         }
-      }
-    catch (IOException e)
-      {
-       SocketException se = new SocketException(e.toString());
-       se.initCause(e);
-       throw se;
-      }
-
     return impl;
   }
 
@@ -363,6 +341,7 @@
     // bind to address/port
     try
       {
+       getImpl().create(true);
        getImpl().bind(tmp.getAddress(), tmp.getPort());
        bound = true;
       }

Reply via email to