Code review request "6402006: FileInputStream.available() returns negative values when reading a large file"

Mandy Chung mandy.chung at oracle.com
Wed Dec 1 21:46:06 UTC 2010


  On 12/01/10 13:39, Alan Bateman wrote:
> Mandy Chung wrote:
>>  Mike, Alan,
>>
>> I have updated the fix to use GetFileSizeEx() and 
>> SetFilePointerEx().  Also add a regression test that creates a large 
>> sparse file.
>>
>> Webrev at:
>>   http://cr.openjdk.java.net/~mchung/6402006/webrev.01/
> This looks much better, and the implementation changes looks okay to me .
>
> Thanks for including a test case. A few minor nits:
>
> - at L46, the name "pos" is a bit mis-leading as it's a big skip value 
> rather than a position.

Agree and will rename it.

> - it might be cleaner if skipBytes returned the number of bytes 
> skipped rather then incrementing a static. That way you could 
> initialize remaining to FILESIZE and then reduce it by the number of 
> bytes skipped.

The skippedBytes variable is solely for troubleshooting use .  I could 
move the System.out.println after each skipBytes call.

> - it's a bit strange for createLargeFile to arrange for the file to be 
> deleted on exit, that seems to be something for the caller to arrange.
> - At L85, bb.flip would be more correct.
>

Ok.  Will update it.

> Otherwise looks good to me.
>

Thanks for the review.
Mandy

> -Alan.




More information about the core-libs-dev mailing list