You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Catherine Hope (JIRA)" <ji...@apache.org> on 2010/06/15 14:05:23 UTC

[jira] Created: (HARMONY-6554) [classlib][luni] Socket.isClosed() returns false after Socket.getInputStream().close()

[classlib][luni] Socket.isClosed() returns false after Socket.getInputStream().close()
--------------------------------------------------------------------------------------

                 Key: HARMONY-6554
                 URL: https://issues.apache.org/jira/browse/HARMONY-6554
             Project: Harmony
          Issue Type: Bug
            Reporter: Catherine Hope
            Priority: Minor


Closing a socket via its input or output stream does not update the isClosed state variable of the Socket object so calling isClosed() will return true instead of false.  This doesn't occur on the RI.  The SocketInput/OutputStream classes are constructed with a SocketImpl subclass, and don't have access to the fields of Socket, so I think the Socket.isClosed() method may need to do more work to check the socket state that just returning its local state.

        ServerSocket server = new ServerSocket(0);
        Socket client = new Socket();
        client.connect(server.getLocalSocketAddress());
        server.accept();
        client.getInputStream().close(); // and the same for getOutputStream()
        assertTrue(client.isClosed());

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.