Socket InputStream.available may return a positive value after shutdown
Jing LV
lvjing at linux.vnet.ibm.com
Mon Aug 15 01:44:21 PDT 2011
Thanks Chris, the fix is fine to me.
于 2011-8-12 18:03, Chris Hegarty 写道:
> On 11/08/2011 19:31, Michael McMahon wrote:
>> On 11/08/11 17:27, Alan Bateman wrote:
>>> Chris Hegarty wrote:
>>>> Here is a first stab at fixing this issue.
>>>>
>>>> http://cr.openjdk.java.net/~chegar/7014860/webrev.00/webrev/
>>>>
>>>> -Chris.
>>> The spec clarification seems reasonable to me. Small typo "the
>>> streams available method" to "the stream's available method".
>>>
>>> Good to see the NIO socket adapter included in the test. One comment
>>> on the test is that the Thread.dumpStack is a bit odd. It might be
>>> better to pass in a test name into the test method and have that
>>> printed by the failure message.
>>>
>>> -Alan.
>>>
>> Just wondering what the motivation for changing this is? I can see
>> the logic in the change
>> all right, but has anyone actually encountered this problem (of an
>> inconsistency
>> between InputStream.available() and the number of bytes that can be
>> returned)?
>
> This fix gives us consistent behavior across all platforms, and
> clarifies the spec so that users know what to expect. Currently the
> behavior on Linux and Windows is to return the amount of unattainable
> data in the socket buffer. Solaris returns 0.
>
> We have two bugs in the bug database (that I can find) for this:
> 6726928: SocketInputStream.available() method does not return 0 when
> it reaches end of file on Linux
> 7014860: Socket.getInputStream().available() not clear for case that
> connection is shutdown for reading
>
> CR 7014860 is the bug being used to fix this issue.
>
> -Chris.
>
>
>>
>> - Michael
--
Best Regards,
Jimmy, Jing LV
More information about the net-dev
mailing list