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

2015-10-17 Thread Claes Redestad
On 2015-10-17 01:37, Xueming Shen wrote: On 10/16/2015 3:20 PM, Claes Redestad wrote: 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

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

2015-10-16 Thread Xueming Shen
On 10/16/2015 3:20 PM, Claes Redestad wrote: 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

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

2015-10-16 Thread Claes Redestad
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

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

2015-10-16 Thread Xueming Shen
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 sh

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

2015-10-16 Thread Claes Redestad
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/~red

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

2015-10-16 Thread Xueming Shen
On 10/16/15 4:49 AM, Claes Redestad wrote: On 2015-10-16 04:09, Xueming Shen wrote: On 10/15/15 3:08 PM, Claes Redestad wrote: On 2015-10-15 23:21, Chris Hegarty wrote: On 15 Oct 2015, at 21:59, e...@zusammenkunft.net wrote: Hello, This does change a bit the semantic of the length check. If

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

2015-10-16 Thread Alan Bateman
On 16/10/2015 12:49, Claes Redestad wrote: Correct, but this is still enough to cause statistically significant increases on our footprint measures. With a reasonable trust limit this change should be safe while avoiding most temporary byte[] allocations when reading meta-inf files. I've ve

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

2015-10-16 Thread Chris Hegarty
On 16/10/15 12:49, Claes Redestad wrote: On 2015-10-16 04:09, Xueming Shen wrote: On 10/15/15 3:08 PM, Claes Redestad wrote: On 2015-10-15 23:21, Chris Hegarty wrote: On 15 Oct 2015, at 21:59, e...@zusammenkunft.net wrote: Hello, This does change a bit the semantic of the length check. If t

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

2015-10-16 Thread Claes Redestad
On 2015-10-16 04:09, Xueming Shen wrote: On 10/15/15 3:08 PM, Claes Redestad wrote: On 2015-10-15 23:21, Chris Hegarty wrote: On 15 Oct 2015, at 21:59, e...@zusammenkunft.net wrote: Hello, This does change a bit the semantic of the length check. If the stream would return more bytes than th

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

2015-10-15 Thread Xueming Shen
On 10/15/15 3:08 PM, Claes Redestad wrote: On 2015-10-15 23:21, Chris Hegarty wrote: On 15 Oct 2015, at 21:59, e...@zusammenkunft.net wrote: Hello, This does change a bit the semantic of the length check. If the stream would return more bytes than the zipentry says the new version would ign

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

2015-10-15 Thread Chris Hegarty
> On 15 Oct 2015, at 11:08 p.m., Claes Redestad > wrote: > > > On 2015-10-15 23:21, Chris Hegarty wrote: >>> On 15 Oct 2015, at 21:59, e...@zusammenkunft.net wrote: >>> >>> Hello, >>> >>> This does change a bit the semantic of the length check. If the stream >>> would return more bytes than

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

2015-10-15 Thread Claes Redestad
On 2015-10-15 23:21, Chris Hegarty wrote: On 15 Oct 2015, at 21:59, e...@zusammenkunft.net wrote: Hello, This does change a bit the semantic of the length check. If the stream would return more bytes than the zipentry says the new version would ignore them, the old version was consuming the

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

2015-10-15 Thread Chris Hegarty
; > Sent: Do., 15 Okt. 2015 22:43 > Subject: RFR [9] 8139706: JarFile.getBytes could use InputStream.readNBytes > > Hi all, > > java.util.jar.JarFile could be improved further by using > InputStream.readNBytes when there's information in the ZipEntry about > the ent

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

2015-10-15 Thread Claes Redestad
Hi Bernd, thanks for looking at this! You're right about the semantic change for this patch in isolation, but compared to the previous implementation that used sun.misc.IOUtils the semantics are unchanged (compare with theprevious implementation of JarFiles::getBytes and sun.misc.IOUtils::rea

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

2015-10-15 Thread ecki
://bernd.eckenfels.net -Original Message- From: Claes Redestad To: "core-libs-dev@openjdk.java.net Libs" Sent: Do., 15 Okt. 2015 22:43 Subject: RFR [9] 8139706: JarFile.getBytes could use InputStream.readNBytes Hi all, java.util.jar.JarFile could be improved furthe

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

2015-10-15 Thread Claes Redestad
Hi all, java.util.jar.JarFile could be improved further by using InputStream.readNBytes when there's information in the ZipEntry about the entry size. Webrev: http://cr.openjdk.java.net/~redestad/8139706/webrev.01/ Bug: https://bugs.openjdk.java.net/browse/JDK-8139706 Testing: verified impro