Socket InputStream.available may return a positive value after shutdown

Alan Bateman Alan.Bateman at oracle.com
Thu Jul 14 01:36:26 PDT 2011


Chris Hegarty wrote:
> :
>
> I can't see that anyone could be depending on the fact the available() 
> would return > 0 after shutdownInput(), given that subsequent reads 
> will always return -1. I just can't see why anyone would require this, 
> but maybe I'm missing something.
You're probably right, and it's just the concern that there may be code 
that won't now read and see the end-of-stream. The other concern is that 
we don't know how custom SocketImpls might behave. Overall the risk does 
seem low.

-Alan.



More information about the net-dev mailing list