harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Catherine Hope (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-6554) [classlib][luni] Socket.isClosed() returns false after Socket.getInputStream().close()
Date Tue, 15 Jun 2010 12:05:23 GMT
[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.


Mime
View raw message