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

Claes Redestad claes.redestad at oracle.com
Fri Oct 16 22:20:30 UTC 2015


On 2015-10-16 18:48, Xueming Shen wrote:
> 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.

We'll also need to check that len != -1 in that extracted check, but I 
guess it's still cleaner:

http://cr.openjdk.java.net/~redestad/8139706/webrev.04

/Claes



More information about the core-libs-dev mailing list