RFR: 8189366: SocketInputStream.available() should check for eof

Bernd Eckenfels ecki at zusammenkunft.net
Thu Oct 26 09:44:23 UTC 2017


What is currently returned at the end of a stream? This looks like a dangerous thing to do, if a existing implementation only read when something is available it might never detect that it reached EOF.

Gruss
Bernd
--
http://bernd.eckenfels.net
________________________________
From: net-dev <net-dev-bounces at openjdk.java.net> on behalf of vyom tewari <vyom.tewari at oracle.com>
Sent: Thursday, October 26, 2017 11:26:15 AM
To: OpenJDK Network Dev list
Subject: RFR: 8189366: SocketInputStream.available() should check for eof

Hi All,

Please review the simple change below.

Webrev   : http://cr.openjdk.java.net/~vtewari/8189366/webrev0.0/index.html

BugId      : https://bugs.openjdk.java.net/browse/JDK-8189366


Currently SocketInputStream.available() does not check for "eof" and
simply delegate to the impl even when "eof" reached. I put a check  to
return 0 if "eof" is already reached.

Thanks,

Vyom

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/net-dev/attachments/20171026/fe786574/attachment.html>


More information about the net-dev mailing list