Re: ZipOutputStream & directories

2023-03-07 Thread Lance Andersen
Morning I will take care of this for you -- Lance Andersen | Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 lance.ander...@oracle.com Sent from my iPhone On Mar 7, 2023, at 7:31 AM, Eirik Bjør

Re: ZipOutputStream & directories

2023-03-07 Thread Eirik Bjørsnøs
> > For the note then you might want to change it to "ZipEntry e = ..." > because the reader see the trailing slash after dir so it is obviously a > directory. > That does indeed make more sense for the general case. > Also the javadoc uses "crc-32" rather than "crc" should we should keep > that

Re: ZipOutputStream & directories

2023-03-07 Thread Alan Bateman
On 07/03/2023 08:21, Eirik Bjørsnøs wrote: : Seems we reached consensus that the right thing to do here is to add an `@apiNote` Here's a draft PR with a suggested CSR: https://github.com/openjdk/jdk/pull/12899

Re: ZipOutputStream & directories

2023-03-07 Thread Eirik Bjørsnøs
> > It would require re-specifying ZOS.setMethod to set the default > compression method for non-directory entries and re-specifying > ZOS.putNextEntry to use the STORED method as the default for directory > entries. Even so, this wouldn't ensure that directory entries have 0 size. > Given that ZOS

Re: ZipOutputStream & directories

2023-03-07 Thread Alan Bateman
On 06/03/2023 20:20, Eirik Bjørsnøs wrote: : I was not thinking of changing anything if the caller actually specified a method. This would be just for the default/unspecified case, in which case ZipEntry.method is -1. It would require re-specifying ZOS.setMethod to set the default compressi

Re: ZipOutputStream & directories

2023-03-07 Thread Eirik Bjørsnøs
On Mon, Mar 6, 2023 at 9:33 PM Lance Andersen wrote: > Adding an API Note will require a CSR. > Lance, Alan Seems we reached consensus that the right thing to do here is to add an `@apiNote` Here's a draft PR with a suggested CSR: https://github.com/openjdk/jdk/pull/12899 Thanks, Eirik.

Re: ZipOutputStream & directories

2023-03-06 Thread Eirik Bjørsnøs
> > Eirik's mail mentions that 7% of Spring Petclinic dependences are > directories. It might be interesting to dig into that to see how they > are generated, is it mostly maven-jar-plugin and if so, which APIs is it > using? > Some stats: Of 109 JAR files, 2 do not have a manifest file, and 28 d

Re: ZipOutputStream & directories

2023-03-06 Thread Lance Andersen
Adding an API Note will require a CSR. And yes, what we often think as the right change tends to bite us (given this code has been in the wild since the 90s) so best to err on the side of documentation vs. assuming this change would not cause more problems than it is worth. Best Lance On Mar

Re: ZipOutputStream & directories

2023-03-06 Thread Eirik Bjørsnøs
On Mon, Mar 6, 2023 at 8:45 PM Alan Bateman wrote: > Changing ZOS.putNextEntry to ignore the method/size provided by the > caller would change long standing behavior, and Hyrum's Law has it that > somebody will notice. I was not thinking of changing anything if the caller actually specified a m

Re: ZipOutputStream & directories

2023-03-06 Thread Lance Andersen
On Mar 6, 2023, at 2:44 PM, Alan Bateman mailto:alan.bate...@oracle.com>> wrote: On 06/03/2023 19:16, Lance Andersen wrote: : So I guess I do not see a huge downside, however we might want to look at a property to adjust in the unlikely event the unexpected occurs? Alan thoughts? Yeah, the

Re: ZipOutputStream & directories

2023-03-06 Thread Alan Bateman
On 06/03/2023 19:16, Lance Andersen wrote: : So I guess I do not see a huge downside, however we might want to look at a property to adjust in the unlikely event the unexpected occurs? Alan thoughts? Yeah, the jar tool does the right thing and writes directories entries with the STORED meth

Re: ZipOutputStream & directories

2023-03-06 Thread Lance Andersen
Hi Eirik, Please see below On Mar 6, 2023, at 1:43 PM, Eirik Bjørsnøs mailto:eir...@gmail.com>> wrote: Hi, I noticed that ZipOutputStream violates APPNOTE.txt when writing directory entries: You are referring to section: 4.3.8 File data Immediately following the loca

ZipOutputStream & directories

2023-03-06 Thread Eirik Bjørsnøs
Hi, I noticed that ZipOutputStream violates APPNOTE.txt when writing directory entries: Zero-byte files, directories, and other file types that > contain no content MUST NOT include file data. Nobody seems to have complained about this violation (I searched JBS), so in itself it might not be wo