RFR [9] 8139706: JarFile.getBytes could use InputStream.readNBytes

Xueming Shen xueming.shen at oracle.com
Fri Oct 16 16:48:06 UTC 2015


On 10/16/15 9:24 AM, Claes Redestad wrote:
>
>
> On 2015-10-16 18:02, Xueming Shen wrote:
>> Why do we no longer check the length of the returned byte[] from 
>> is.readAllBytes() against ze.getSize()?
>> I think the original IOUtils.readFully() throws EOFE if we don't get 
>> enough bytes.
>
> Good catch, this should do it:
>
> http://cr.openjdk.java.net/~redestad/8139706/webrev.03/
>
looks fine. though it might be better to simply check len != b.length, 
as it's still possible that reallAllBytes
returns a byte[] with length > len, if the entry is compressed, and the 
"length" in entry does not really
match the length of the bytes from the inflater.

If you go with len != b.length, you can pull two checks out and 
consolidate them at the end before return.

-Sherman

> /Claes
>
>>
>> -Sherman 
>




More information about the core-libs-dev mailing list