Re: RFR: 8321274: Rename ZipEntry.extraAttributes to ZipEntry.externalFileAttributes [v4]

2024-06-29 Thread Eirik Bjørsnøs
On Sun, 12 May 2024 14:37:23 GMT, Chen Liang wrote: > I believe this field only captures the 2 bytes at higher indices of External > File Attribute; it's not the complete 4-byte external file attributes and > this value is not captured unless "Version made by" field's larger index byte > (byte

Re: RFR: 8321274: Rename ZipEntry.extraAttributes to ZipEntry.externalFileAttributes [v5]

2024-06-29 Thread Eirik Bjørsnøs
x27;, 'extra.attr' after > these updates, and found nothing related to zip/jar. The `zip` and `jar` > tests run clean: > > > make test TEST="test/jdk/java/util/jar" > make test TEST="test/jdk/java/util/zip" Eirik Bjørsnøs has updated the pull req

Re: RFR: 8321274: Rename ZipEntry.extraAttributes to ZipEntry.externalFileAttributes [v4]

2024-06-29 Thread Eirik Bjørsnøs
On Thu, 9 May 2024 12:00:13 GMT, Jaikiran Pai wrote: > Hello Eirik, it will be better to merge with the latest master branch and run > the tier tests before integrating. Life happened, but I have now merged with the latest master and GHA runs green. Did you want to run additional testing befor

java.util.zip.ZipError seems unused

2024-06-30 Thread Eirik Bjørsnøs
Hi! The java.util.zip.ZipError class seems unused in OpenJDK. I assume this is legacy from the native ZIP implementation in Java 8. This exception class extends InternalError and seems to have been added in Java 6 to help compatibility with existing code catching InternalError (JDK-4615343) This

Re: RFR: 8321274: Rename ZipEntry.extraAttributes to ZipEntry.externalFileAttributes [v5]

2024-07-02 Thread Eirik Bjørsnøs
On Tue, 2 Jul 2024 12:51:26 GMT, Jaikiran Pai wrote: > Can you issue a `/integrate delegate` command on this PR so that it then > allows me to do the actual integration along with the Oracle side of changes? Done. And big thanks for your help getting this long-lasting change across the finish

Integrated: 8321274: Rename ZipEntry.extraAttributes to ZipEntry.externalFileAttributes

2024-07-02 Thread Eirik Bjørsnøs
On Mon, 4 Dec 2023 15:34:34 GMT, Eirik Bjørsnøs wrote: > Please consider this PR which suggests we rename `ZipEntry.extraAttributes` > to `ZipEntry.externalFileAttributes`. > > This field was introduced in > [JDK-8218021](https://bugs.openjdk.org/browse/JDK-8218021), original

Re: RFR: 8322256: Define and document GZIPInputStream concatenated stream semantics [v5]

2024-07-19 Thread Eirik Bjørsnøs
On Thu, 6 Jun 2024 17:03:57 GMT, Archie Cobbs wrote: >> `GZIPInputStream` supports reading data from multiple concatenated GZIP data >> streams since [JDK-4691425](https://bugs.openjdk.org/browse/JDK-4691425). In >> order to do this, after a GZIP trailer frame is read, it attempts to read a >>

Re: RFR: 8322256: Define and document GZIPInputStream concatenated stream semantics [v5]

2024-07-19 Thread Eirik Bjørsnøs
On Thu, 6 Jun 2024 17:03:57 GMT, Archie Cobbs wrote: >> `GZIPInputStream` supports reading data from multiple concatenated GZIP data >> streams since [JDK-4691425](https://bugs.openjdk.org/browse/JDK-4691425). In >> order to do this, after a GZIP trailer frame is read, it attempts to read a >>

Re: RFR: 8322256: Define and document GZIPInputStream concatenated stream semantics [v5]

2024-07-19 Thread Eirik Bjørsnøs
On Mon, 15 Jul 2024 10:01:47 GMT, Jaikiran Pai wrote: >> Archie Cobbs has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 12 commits: >> >> - Bump @since from 23 to 24. >> - Merge branch 'master' into JDK-8322256 >> - Relabel "trai

Re: java.util.zip.ZipError seems unused

2024-07-19 Thread Eirik Bjørsnøs
via 8145260 and 8037394 for JDK 9 > > The test should also be re-written at this point > > Jai or I can make a pass to see if there are any external usages via a > corpus search but I tend to doubt it > > On Jun 30, 2024, at 3:20 AM, Eirik Bjørsnøs wrote: > > Hi! >

Re: RFR: 8322256: Define and document GZIPInputStream concatenated stream semantics [v5]

2024-07-22 Thread Eirik Bjørsnøs
On Fri, 19 Jul 2024 23:16:07 GMT, Archie Cobbs wrote: >> src/java.base/share/classes/java/util/zip/GZIPInputStream.java line 143: >> >>> 141: * @param allowConcatenation true to allow multiple concatenated >>> compressed data streams, >>> 142: * or false to e

RFR: 8338729: Retire the test jdk/java/util/zip/TestZipError.java

2024-08-23 Thread Eirik Bjørsnøs
Please review this test-only, cleanup PR which proposes that we retire the `jdk/java/util/zip/TestZipError.java` test. The test has fallen out of sync with its original and stated purpose described by its name, `@summary` tag and code comments. The error condition actually being exercised has e

RFR: 8336843: Deprecate java.util.zip.ZipError for removal

2024-08-23 Thread Eirik Bjørsnøs
Please review this PR which suggests to deprecate the unused class `java.util.zip.ZipError` for removal. The class has been unsed by OpenJDK since the ZIP API was rewritten from native to Java in JDK 9. I opted to not explain the reason for the deprecation in detail, but instead simply point

Re: RFR: 8336843: Deprecate java.util.zip.ZipError for removal

2024-08-24 Thread Eirik Bjørsnøs
On Fri, 23 Aug 2024 19:13:23 GMT, Lance Andersen wrote: > So would be good to also alert those projects if possible I guess the deprecation warning itself is the "official" channel for communicating this type of information. But I agree it doesn't hurt to alert at least some of the larger proj

RFR: 8338931: ZipEntry.flags could be made internal to ZipOutputStream

2024-08-24 Thread Eirik Bjørsnøs
Please review this refactoring PR which moves the `ZipEntry.flags` field to `ZipOutputStream.XEntry`. Moving this field will save four bytes from the `ZipEntry` object size and also saves an unneccessary read in `ZipFile.getZipEntry`. Testing: This PR is a refactoring of existing code and does

Re: RFR: 8338931: ZipEntry.flags could be made internal to ZipOutputStream

2024-08-25 Thread Eirik Bjørsnøs
On Sat, 24 Aug 2024 10:49:56 GMT, Eirik Bjørsnøs wrote: > Please review this refactoring PR which moves the `ZipEntry.flags` field to > `ZipOutputStream.XEntry`. > > Moving this field will save four bytes from the `ZipEntry` object size and > also saves an unnec

Re: RFR: 8338931: ZipEntry.flag could be made internal to ZipOutputStream [v2]

2024-08-27 Thread Eirik Bjørsnøs
/jdk/java/util/jar" > > > Performance: > > The JMH benchmark `java.util.zip.ZipFileGetEntry.getEntryHit` show a small > but consistent improvement (2-3%). Eirik Bjørsnøs has updated the pull request incrementally with one additional commit since the last revision: Revert "Rename XEn

Re: RFR: 8336843: Deprecate java.util.zip.ZipError for removal [v2]

2024-08-27 Thread Eirik Bjørsnøs
; section there once we reach a concensus on the deprecation note in this PR. > > This deprecation was initially suggested here: > https://mail.openjdk.org/pipermail/core-libs-dev/2024-June/125720.html Eirik Bjørsnøs has updated the pull request incrementally with one additional commit si

Re: RFR: 8336843: Deprecate java.util.zip.ZipError for removal [v2]

2024-08-27 Thread Eirik Bjørsnøs
On Tue, 27 Aug 2024 15:51:24 GMT, Eirik Bjørsnøs wrote: >> Please review this PR which suggests to deprecate the unused class >> `java.util.zip.ZipError` for removal. >> >> The class has been unsed by OpenJDK since the ZIP API was rewritten from >> native to Ja

Re: RFR: 8336843: Deprecate java.util.zip.ZipError for removal [v2]

2024-08-27 Thread Eirik Bjørsnøs
On Tue, 27 Aug 2024 17:24:42 GMT, Lance Andersen wrote: > The javadoc should be focused on the current JDK release, not the prior > history of this Class Makes sense, let's focus on the current release. > ``` > * @deprecated ZipError is deprecated and subject to removal in a > * future rele

Re: RFR: 8336843: Deprecate java.util.zip.ZipError for removal [v2]

2024-08-28 Thread Eirik Bjørsnøs
On Tue, 27 Aug 2024 20:37:12 GMT, Lance Andersen wrote: > Other options could be: > > _ZipError is obsolete and is no longer used. ZipException should be used > instead_ This looks good to me! I've pushed this with a an empty line above to visually separate the class description from the java

Re: RFR: 8336843: Deprecate java.util.zip.ZipError for removal [v3]

2024-08-28 Thread Eirik Bjørsnøs
; section there once we reach a concensus on the deprecation note in this PR. > > This deprecation was initially suggested here: > https://mail.openjdk.org/pipermail/core-libs-dev/2024-June/125720.html Eirik Bjørsnøs has updated the pull request with a new target base due to a merge or a

RFR: 8339154: Cleanups and JUnit conversion of test/jdk/java/util/zip/Available.java

2024-08-28 Thread Eirik Bjørsnøs
Please review this test-only PR which addresses several issues with the `test/jdk/java/util/zip/Available.java` test: * The test is converted to JUnit 5 * The test now creates its own test vector programmatically instead of relying on a binary `input.jar` test vector * Coverage is added for ca

Re: RFR: 8336843: Deprecate java.util.zip.ZipError for removal

2024-08-28 Thread Eirik Bjørsnøs
On Sun, 25 Aug 2024 13:36:18 GMT, Lance Andersen wrote: >> I think linking to the CSR would be fine, but there is no prerequisite for >> API specs to link to CSRs. Need @jddarcy to double check here. I was >> emulating `Thread.stop`: >> https://github.com/openjdk/jdk/blob/5671f836039ef1683e3e9

Integrated: 8338729: Retire the test jdk/java/util/zip/TestZipError.java

2024-08-28 Thread Eirik Bjørsnøs
On Wed, 21 Aug 2024 09:59:38 GMT, Eirik Bjørsnøs wrote: > Please review this test-only, cleanup PR which proposes that we retire the > `jdk/java/util/zip/TestZipError.java` test. > > The test has fallen out of sync with its original and stated purpose > described by its name,

Re: RFR: 8322256: Define and document GZIPInputStream concatenated stream semantics [v9]

2024-08-29 Thread Eirik Bjørsnøs
On Wed, 28 Aug 2024 19:56:04 GMT, Lance Andersen wrote: >> Sounds good. How would you like to do that? >> >> E.g. we could just remove the words "In particular, some GZIP compression >> tools function by partitioning the input, compressing each partition >> separately, and then concatenating t

Re: RFR: 8322256: Define and document GZIPInputStream concatenated stream semantics [v10]

2024-08-29 Thread Eirik Bjørsnøs
On Wed, 28 Aug 2024 21:56:50 GMT, Archie Cobbs wrote: >> `GZIPInputStream` supports reading data from multiple concatenated GZIP data >> streams since [JDK-4691425](https://bugs.openjdk.org/browse/JDK-4691425). In >> order to do this, after a GZIP trailer frame is read, it attempts to read a >

Re: RFR: 8322256: Define and document GZIPInputStream concatenated stream semantics [v10]

2024-08-29 Thread Eirik Bjørsnøs
On Wed, 28 Aug 2024 21:56:50 GMT, Archie Cobbs wrote: >> `GZIPInputStream` supports reading data from multiple concatenated GZIP data >> streams since [JDK-4691425](https://bugs.openjdk.org/browse/JDK-4691425). In >> order to do this, after a GZIP trailer frame is read, it attempts to read a >

Re: RFR: 8322256: Define and document GZIPInputStream concatenated stream semantics [v10]

2024-08-29 Thread Eirik Bjørsnøs
On Wed, 28 Aug 2024 21:56:50 GMT, Archie Cobbs wrote: >> `GZIPInputStream` supports reading data from multiple concatenated GZIP data >> streams since [JDK-4691425](https://bugs.openjdk.org/browse/JDK-4691425). In >> order to do this, after a GZIP trailer frame is read, it attempts to read a >

Re: RFR: 8339154: Cleanups and JUnit conversion of test/jdk/java/util/zip/Available.java [v2]

2024-08-29 Thread Eirik Bjørsnøs
ed, but long-standing behavior of > `ZipFileInputStream.available()` (The InputStream returned for `STORED` > entries) > > Additionally, the test is split into multiple methods, adding javadoc > comments for each of them. Eirik Bjørsnøs has updated the pull request incremen

Re: RFR: 8339154: Cleanups and JUnit conversion of test/jdk/java/util/zip/Available.java [v2]

2024-08-29 Thread Eirik Bjørsnøs
On Thu, 29 Aug 2024 16:21:36 GMT, Lance Andersen wrote: >> Eirik Bjørsnøs has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Collapse the ZipFile-related tests into a single, parameterized method > > test/jd

Re: RFR: 8339154: Cleanups and JUnit conversion of test/jdk/java/util/zip/Available.java [v3]

2024-08-29 Thread Eirik Bjørsnøs
ed, but long-standing behavior of > `ZipFileInputStream.available()` (The InputStream returned for `STORED` > entries) > > Additionally, the test is split into multiple methods, adding javadoc > comments for each of them. Eirik Bjørsnøs has updated the pull request incremen

Re: RFR: 8339154: Cleanups and JUnit conversion of test/jdk/java/util/zip/Available.java [v2]

2024-08-29 Thread Eirik Bjørsnøs
On Thu, 29 Aug 2024 16:50:56 GMT, Eirik Bjørsnøs wrote: >> Please review this test-only PR which addresses several issues with the >> `test/jdk/java/util/zip/Available.java` test: >> >> * The test is converted to JUnit 5 >> * The test now creates its own test vect

Integrated: 8339154: Cleanups and JUnit conversion of test/jdk/java/util/zip/Available.java

2024-08-29 Thread Eirik Bjørsnøs
On Wed, 28 Aug 2024 11:12:42 GMT, Eirik Bjørsnøs wrote: > Please review this test-only PR which addresses several issues with the > `test/jdk/java/util/zip/Available.java` test: > > * The test is converted to JUnit 5 > * The test now creates its own test vector programmatic

Re: RFR: 8322256: Define and document GZIPInputStream concatenated stream semantics

2024-08-30 Thread Eirik Bjørsnøs
On Fri, 30 Aug 2024 07:27:11 GMT, Eirik Bjørsnøs wrote: > Please review this PR with picks up on the excellent work done by > @archiecobbs in #18385 > > The proposed changes aim to solve two issues with the current > `java.util.zip.GZIPInputStream`: > > * The

RFR: 8322256: Define and document GZIPInputStream concatenated stream semantics

2024-08-30 Thread Eirik Bjørsnøs
Please review this PR with picks up on the excellent work done by @archiecobbs in #18385 The proposed changes aim to solve two issues with the current `java.util.zip.GZIPInputStream`: * The class parses multiple concatenated GZIP files as a single stream. This behavior is not documented in th

Re: RFR: 8322256: Define and document GZIPInputStream concatenated stream semantics [v2]

2024-08-30 Thread Eirik Bjørsnøs
. > > Testing: > > * A new test `GZIPInputStreamConcat` verifies the behaviors being specified > in this PR > * A new test `GZIPInputStreamGzipCommand` verifies decompression of various > GZIP files created using the `gzip` command. Eirik Bjørsnøs has updated the pull request in

ZipFile.isSignatureRelated returns true for files in META-INF subdirectories

2023-01-10 Thread Eirik Bjørsnøs
Hi, ZipFile.isSignatureRelated currently returns true for paths such as the following: META-INF/libraries/org.bouncycastle:bcprov-jdk15on:jar-1.70/META-INF/BC2048KE.DSA While this path does start with "META-INF/" and ends with ".DSA", the file does not live in the META-INF/ directory _directly_,

Re: ZipFile.isSignatureRelated returns true for files in META-INF subdirectories

2023-01-12 Thread Eirik Bjørsnøs
> > ZipFile.isSignatureRelated currently returns true for paths such as the > following: > > > META-INF/libraries/org.bouncycastle:bcprov-jdk15on:jar-1.70/META-INF/BC2048KE.DSA > I found a couple more call sites of SignatureFileVerifier.isBlockOrSF which incorrectly treat [SF,DSA,RSA,EC] files as

ZIP entry copy without recompression

2023-01-19 Thread Eirik Bjørsnøs
Hi, A common use case for java.util.zip in build tools involves copying entries from a ZipFile or ZipInputStream to a ZipOutputStream without actually modifying the data. Example use cases include minification (make a JAR with only the reachable classes) and merging (combine several JAR files int

Update TestTooManyEntries to run non-manual

2023-01-26 Thread Eirik Bjørsnøs
Hi, This PR updates the test TestTooManyEntries to not create gigabytes of ZIP files, allowing the test to run fast and non-manual: https://github.com/openjdk/jdk/pull/12231 May I please get some help with filing a JBS for this PR? Thanks, Eirik.

Why does ZipFile.Source.readFullyAt read in chunks?

2023-01-27 Thread Eirik Bjørsnøs
Hi, ZipFile.Source.readFullyAt caps its calls to RandomAccessFile.readFully to a maximum of 8192 bytes per call, like this: int N = len; > while (N > 0) { > int n = Math.min(BUF_SIZE, N); > zfile.readFully(buf, off, n); > off += n; > N -= n; > } I'm observing a ~10% speedup of t

PR: Update the field access methods in ZipUtils to use the VarHandle API

2023-01-28 Thread Eirik Bjørsnøs
Hi, Please review the following PR which suggests updating the field access methods in ZipUtils to use the VarHandle API when reading multibyte values from byte arrays: https://github.com/openjdk/jdk/pull/12273 Thanks, Eirik.

Re: PR: Update the field access methods in ZipUtils to use the VarHandle API

2023-01-28 Thread Eirik Bjørsnøs
> > Please review the following PR which suggests updating the field access > methods in ZipUtils to use the VarHandle API > https://github.com/openjdk/jdk/pull/12273 > Never mind, Claes pointed out that VarHandles may take some time to warp up and we did indeed measure a regression for cold-start

Re: Update TestTooManyEntries to run non-manual

2023-01-28 Thread Eirik Bjørsnøs
On Sat, Jan 28, 2023 at 4:47 PM Alan Bateman wrote: > The intention of the test was exercise a multi-GB CEN. So I think it > would be great if it could be re-written as an automatic test but I > think it should be a real ZIP file, make use of sparse files might help. > Alan, Yes, this change do

Re: Update TestTooManyEntries to run non-manual

2023-01-28 Thread Eirik Bjørsnøs
On Sat, Jan 28, 2023 at 5:29 PM Lance Andersen wrote: > I think it is fine to move the validation immediately following findEND() > though I am not sure there is a big win overall. > > I also would prefer to see the test based off of an actual ZIP(or at least > have the current/modified version o

Re: Why does ZipFile.Source.readFullyAt read in chunks?

2023-01-28 Thread Eirik Bjørsnøs
On Sat, Jan 28, 2023 at 6:06 PM Alan Bateman wrote: > 8k is the threshold at which RAF spills into a temporary malloc'ed > buffer for the I/O operation. At some point the RAF implementation will > be replaced (we need to do this for a Project Loom), but in the mean > time, it probably would requi

Re: Update TestTooManyEntries to run non-manual

2023-01-30 Thread Eirik Bjørsnøs
On Sat, Jan 28, 2023 at 5:29 PM Lance Andersen wrote: > I also would prefer to see the test based off of an actual ZIP(or at least > have the current/modified version of the test). > Consensus seems to be we leave the existing manual test alone. I've updated the PR to leave the existing test as-

Avoid string decoding in ZipFile.Source.getEntryPos

2023-02-02 Thread Eirik Bjørsnøs
Hi, Please review this PR which speeds up ZipFile entry lookup by ~17%, mostly by removing a string decode / allocation when getEntryPos compares lookup names with names in the CEN: https://github.com/openjdk/jdk/pull/12290 Thanks, Eirik.

Re: Update TestTooManyEntries to run non-manual

2023-02-06 Thread Eirik Bjørsnøs
On Sat, Jan 28, 2023 at 5:29 PM Lance Andersen wrote: > I think it is fine to move the validation immediately following findEND() > though I am not sure there is a big win overall. > > I also would prefer to see the test based off of an actual ZIP(or at least > have the current/modified version o

Incorrect capitalization in Arrays.compare and Arrays.mismatch Javadocs

2023-02-09 Thread Eirik Bjørsnøs
Please review this documentation-only change which fixes incorrect capitalization when referencing "aToIndex" and "bToIndex" in the Javadocs of Arrays.compare and Arrays.mismatch. https://github.com/openjdk/jdk/pull/12488 Thanks, Eirik.

Convert CorruptedZipFiles to testNG

2023-02-14 Thread Eirik Bjørsnøs
Hi! CorruptedZipFiles could benefit from some modernization and a conversion to testNG: https://github.com/openjdk/jdk/pull/12563 Thanks, Eirik.

Speed up latin1 case folding

2023-02-17 Thread Eirik Bjørsnøs
Hi, The following PR suggests we can speed up Character.toUpperCase and Character.toLowerCase for latin1 code points by applying 'the oldest ASCII trick in the book': https://github.com/openjdk/jdk/pull/12623 Thanks, Eirik.

Speed up StringLatin1.regionMatchesCI

2023-02-18 Thread Eirik Bjørsnøs
Hi, The following PR suggests we can speed up StringLatin1.regionMatchesCI by applying 'the oldest ASCII trick in the book': https://github.com/openjdk/jdk/pull/12632 Thanks, Eirik.

Speed up StringLatin1.regionMatchesCI_UTF16

2023-02-18 Thread Eirik Bjørsnøs
Hi, This PR continues the effort to speed up case-insensitive string comparisons, this time tackling comparison of latin1-coded strings with utf16-coded strings: https://github.com/openjdk/jdk/pull/12637 This builds on top of #12632, it makes sense to review that one first. Thanks, Eirik.

RFD: Consumer.empty()

2023-02-20 Thread Eirik Bjørsnøs
Hi, So I found myself writing some code which sets up a j.u.s.Stream processing pipeline where the stream can optionally be traced/logged via a peeking Consumer. The default should be not to trace, in which case I initially set the Consumer to null. But then I need to check that trace != null whe

Re: RFD: Consumer.empty()

2023-02-20 Thread Eirik Bjørsnøs
; will learn how to read and write x -> true and () -> { } and that their > usage will become idiomatic. Even the value of Function.identity() over x > -> x is questionable. Makes sense. And where would we stop..? EIrik. On Mon, Feb 20, 2023 at 7:24 PM Eirik Bjørsnøs wrote: > H

RFD: Invalid CRC in ZipFile, ZipFileSystem

2023-02-23 Thread Eirik Bjørsnøs
Hi, While writing various ZIP related tests, I noticed a discrepancy in the treatment of invalid CRC values: While ZipInputStream rejects invalid CRC values when consuming streams, ZipFile and ZipFileSystem do not. While this is inconsistent, it is perhaps not a bug we want to fix? In any case,

Re: RFD: Invalid CRC in ZipFile, ZipFileSystem

2023-02-24 Thread Eirik Bjørsnøs
On Fri, Feb 24, 2023 at 9:22 AM Alan Bateman wrote: > As a general point, the ZIP format can have redundant metadata and there > can be cases where the CRC-32 isn't available when writing a LOC header. > ZipInputStream throws exceptions in both of these cases. If the general purpose bit flag 3 i

Re: RFD: Invalid CRC in ZipFile, ZipFileSystem

2023-02-24 Thread Eirik Bjørsnøs
> > Indeed, but I found it a bit amusing that ZipFile (and ZipFileSystem), > which both see the "full picture", are actually the ones to not enforce the > CRC. > With the current state of affairs, it is conceivable that a single-event upset could cause an IF_ICMPNE byte code to be flipped into an

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

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 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-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-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 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: Current state = CODING_END, new state = FLUSHED?

2023-03-17 Thread Eirik Bjørsnøs
On Fri, Mar 17, 2023 at 12:00 PM Jaikiran Pai wrote: > Additional details in that issue state that the JDK being used is Java 15. > There have been code changes in this piece of code in java.util.zip.ZipFile > since then. > Looks to me like an instance of JDK-8260010 [1], which was a thread-safe

Re: Current state = CODING_END, new state = FLUSHED?

2023-03-17 Thread Eirik Bjørsnøs
> > The fix was backported to 15, not sure which build it was included in. > Sorry, seems the fix was backported to 16, not 15. The recommendation would still be the same: Upgrade to a more recent JDK release. 17 is the current LTS release. Eirik.

RFD: Should jextract be extracted from the JDK?

2023-03-25 Thread Eirik Bjørsnøs
Hi, I'll raise this periodic (?) question for discussion, but first I want to make it clear I have no opinion myself. Here is the question in question: Should jextract be extracted from the JDK? If so, would it make sense to do it now rather than later? I'm asking this because I remember this b

Re: RFD: Should jextract be extracted from the JDK?

2023-03-26 Thread Eirik Bjørsnøs
github.com/openjdk/jextract > > For which binary snapshots are also provided here: > > https://jdk.java.net/jextract/ > > (this change happened roughly an year ago [1]). > > Cheers > Maurizio > > [1] - https://mail.openjdk.org/pipermail/panama-dev/2022-March

Re: Draft: Deprecate toLowerCase()/toUpperCase() and provide locale insensitive alternative

2023-04-12 Thread Eirik Bjørsnøs
On Wed, Apr 12, 2023 at 10:27 PM Roger Riggs wrote: > Hi, > > The status quo takes a balance between trying do the right thing and > creating a headache for lots of developers. > Deprecating the existing methods would cause lots of warnings and > provide little actual improvement. > It is a matt

Question: Review process of release notes

2023-04-12 Thread Eirik Bjørsnøs
Hi, My understanding of the review process for release notes is a bit sketchy, I could need some clarification. Consider my release note for JDK-8205129 Remove java.lang.Compiler as an example: https://bugs.openjdk.org/browse/JDK-8304459 The PR is approved and integrated and the issue Resolved

Re: Question: Review process of release notes

2023-04-13 Thread Eirik Bjørsnøs
> > https://openjdk.org/guide/#release-notes Thanks David, I just found this and it seems to answer most of my questions. It does not explicitly say that the release note is considered approved when the PR is approved, but I guess I'm safe to assume so. Cheers, Eirik.

RFD: Notes in String.toUpperCase(), String.toLowerCase() could be more specific refering to "locale"

2023-04-13 Thread Eirik Bjørsnøs
Hello, During a discussion about the deprecation of String.toLowerCase(), String.toUpperCase [1], it occurred to me that the current Note in the API documentation could be more specific when talking about locales. Before going ahead and suggesting a PR/CSR, I'd like to socialize the idea that we

Re: RFD: Notes in String.toUpperCase(), String.toLowerCase() could be more specific refering to "locale"

2023-04-13 Thread Eirik Bjørsnøs
> > Any thoughts? > I'll add my own thoughts, which is that busy developers cannot be expected to do the "right thing" if they don't understand the API Note. Improving the note such that more developers understand the consequences of using the method should help developers write more correct code

Re: Question: Review process of release notes

2023-04-13 Thread Eirik Bjørsnøs
> > > Unless your reviewers indicate they have seen the Release Note I would > not assume that. If unclear ask someone to add a comment to the JBS > issue saying they think it is okay. > This was very useful. Thank, Eirik.

Re: Draft: Deprecate toLowerCase()/toUpperCase() and provide locale insensitive alternative

2023-04-13 Thread Eirik Bjørsnøs
> > In that case, isn't there something a little backwards about saying we > should continue sweeping them under the rug? (Am I being too idealistic?) > I sympathise with the concern of causing many warnings/errors, and the right time to do these things never seems to be "now". But let's look at

Revisiting JDK-4512189: ZipConstants leaking into public APIs

2023-11-28 Thread Eirik Bjørsnøs
Hi, JDK-4512189 [1] raised the issue that ZipFile, ZipEntry, ZipInputStream and ZipOutputStream all implement the non-public ZipConstants interface. While the interface itself is non-public, the constants defined unfortunately leak into the public API as constants of the mentioned classes. This me

Re: Revisiting JDK-4512189: ZipConstants leaking into public APIs

2023-11-28 Thread Eirik Bjørsnøs
On Tue, Nov 28, 2023 at 5:28 PM David Lloyd wrote: > I agree, I always thought that this was a bizarre thing to expose in a > public API so it being accidental does explain things. But maybe the > appropriate fix is even simpler now in these modern times: one could remove > the `implements` and a

Re: Revisiting JDK-4512189: ZipConstants leaking into public APIs

2023-11-28 Thread Eirik Bjørsnøs
On Tue, Nov 28, 2023 at 6:16 PM Alan Bateman wrote: > > In light of this, I would like to revisit this issue, 22 years later: > [...] > > This is a JDK 1.1 era mistake. It would a source incompatible change to > "remove" the constants. It would require corpus searches to gauge the > impact. I t

Re: Revisiting JDK-4512189: ZipConstants leaking into public APIs

2023-11-28 Thread Eirik Bjørsnøs
> > But keeping this "peculiarity" afloat does not come for free either. > Let me add that keeping the constants also incurs a maintenance cost: The fact that these constants are "effectively and accidentally public" is unusual, but needs to be understood and enforced by maintainers. Their names,

Re: Revisiting JDK-4512189: ZipConstants leaking into public APIs

2023-12-01 Thread Eirik Bjørsnøs
On Tue, Nov 28, 2023 at 6:16 PM Alan Bateman wrote: > This is a JDK 1.1 era mistake. It would a source incompatible change to > "remove" the constants. It would require corpus searches to gauge the > impact. Alan, I've tried to assess the impact by using Github's Code Search. As far as I can t

Re: ZipEntry

2023-12-12 Thread Eirik Bjørsnøs
Alan, ZipOutputStream is a relatively high-level API for producing ZIP files. There are many shapes and corner cases allowed by APPNOTE.TXT which ZipOutputStream has no means to produce. So while exposing the "external file attributes" field (which was incorrectly named "extraAttributes" in ZipEnt

Integrated: 8321802: (zipfs) Add validation of incorrect LOC signature in ZipFileSystem

2023-12-22 Thread Eirik Bjørsnøs
On Mon, 11 Dec 2023 15:38:28 GMT, Eirik Bjørsnøs wrote: > Please review this PR which adds validation of incorrect LOC signatures in > `ZipFileSystem`. > > `ZipFile` already rejects the case where the offset pointed to from the CEN > header does not start with the expected LO

RFR: 7009069: ZipFile.getEntry(String name) does NOT respect the "language encoding flag"

2023-12-31 Thread Eirik Bjørsnøs
Please review this test-only PR which adds test coverage for `ZipFile.getEntry` under certain charset conditions. When `ZipFile.getEntry` is called for an entry which has the `Language encoding flag` general purpose bit flag set, then `ZipCoder.UTF8` is used unconditionally, even when a diffe

Re: RFR: 7009069: ZipFile.getEntry(String name) does NOT respect the "language encoding flag" [v2]

2023-12-31 Thread Eirik Bjørsnøs
erify the `Language encoding flag` condition for > `ZipFile.getEntry`. > > Testing: Verified that the test indeed fails when > `ZipFile.Source.getEntryPos` is updated to use the ZipFile's ZipCoder as > suggested above. Eirik Bjørsnøs has updated the pull request increme

Re: RFR: 7009069: ZipFile.getEntry(String name) does NOT respect the "language encoding flag" [v2]

2023-12-31 Thread Eirik Bjørsnøs
On Sun, 31 Dec 2023 21:14:54 GMT, Lance Andersen wrote: > With the conversion, I probably would would at separating out the test runs > for ZipFile and ZipInputStream and introduce a DataProvider. Thanks, I separated into two top-level parameterized tests as suggested. Indeed this was much cle

Re: RFR: 8322802: Add testing for ZipFile.getEntry respecting the 'Language encoding' flag [v2]

2024-01-01 Thread Eirik Bjørsnøs
On Mon, 1 Jan 2024 08:35:17 GMT, Alan Bateman wrote: > So I think create a new issue for the test work or else change the title on > this one. Filed a new issue [JDK-8322802](https://bugs.openjdk.org/browse/JDK-8322802) for tracking this PR. - PR Comment: https://git.openjdk.org/

Re: RFR: 8322802: Add testing for ZipFile.getEntry respecting the 'Language encoding' flag [v3]

2024-01-01 Thread Eirik Bjørsnøs
erify the `Language encoding flag` condition for > `ZipFile.getEntry`. > > Testing: Verified that the test indeed fails when > `ZipFile.Source.getEntryPos` is updated to use the ZipFile's ZipCoder as > suggested above. Eirik Bjørsnøs has updated the pull request incremental

RFR: 8313739: ZipOutputStream.close() should always close the wrapped stream

2024-01-01 Thread Eirik Bjørsnøs
Please consider this PR which makes `DeflaterOutputStream.close()` always close its wrapped output stream. Currently, closing of the wrapped output stream happens outside the finally block where `finish()` is called. If `finish()` throws, this means the wrapped stream will not be closed. This c

Re: RFR: 8313739: ZipOutputStream.close() should always close the wrapped stream [v2]

2024-01-02 Thread Eirik Bjørsnøs
fication. > > Testing: The PR adds a new JUnit 5 test `CloseWrappedStream.java` which > simulates the failure condition and verifies that the wrapped stream was > closed under failing and non-failing conditions. Eirik Bjørsnøs has updated the pull request incrementally with one additio

Re: RFR: 8313739: ZipOutputStream.close() should always close the wrapped stream [v2]

2024-01-02 Thread Eirik Bjørsnøs
On Tue, 2 Jan 2024 08:35:47 GMT, Jaikiran Pai wrote: > This call has a potential to throw an `IOException` in which case any > original `IOException` thrown from the `finish()` call will be lost. Good catch. Adopted your suggestion with a few changes: - The catch for IOException during finish(

Re: RFR: 8322802: Add testing for ZipFile.getEntry respecting the 'Language encoding' flag [v4]

2024-01-02 Thread Eirik Bjørsnøs
erify the `Language encoding flag` condition for > `ZipFile.getEntry`. > > Testing: Verified that the test indeed fails when > `ZipFile.Source.getEntryPos` is updated to use the ZipFile's ZipCoder as > suggested above. Eirik Bjørsnøs has updated the pull request incremen

Re: RFR: 8322802: Add testing for ZipFile.getEntry respecting the 'Language encoding' flag [v3]

2024-01-02 Thread Eirik Bjørsnøs
On Tue, 2 Jan 2024 07:43:03 GMT, Jaikiran Pai wrote: >> Eirik Bjørsnøs has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Add @bug tag for 8322802 > > test/jdk/java/util/zip/Zi

Re: RFR: 8322802: Add testing for ZipFile.getEntry respecting the 'Language encoding' flag [v3]

2024-01-02 Thread Eirik Bjørsnøs
On Tue, 2 Jan 2024 08:02:46 GMT, Jaikiran Pai wrote: > The change to allow user/application specific arbritary charsets to the > `ZipFile` constructor seems to have been done long back in Java 1.7 days as > part of https://bugs.openjdk.org/browse/JDK-4244499. > > This is merely an observation

Re: RFR: 8313739: ZipOutputStream.close() should always close the wrapped stream [v3]

2024-01-02 Thread Eirik Bjørsnøs
fication. > > Testing: The PR adds a new JUnit 5 test `CloseWrappedStream.java` which > simulates the failure condition and verifies that the wrapped stream was > closed under failing and non-failing conditions. Eirik Bjørsnøs has updated the pull request incrementally with two additiona

Re: RFR: 8313739: ZipOutputStream.close() should always close the wrapped stream [v2]

2024-01-02 Thread Eirik Bjørsnøs
On Tue, 2 Jan 2024 10:37:55 GMT, Jaikiran Pai wrote: >> Eirik Bjørsnøs has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Prevent IOException thrown during finish() from being lost if an >> IOException is th

Re: RFR: 8321616: Retire binary test vectors in test/jdk/java/util/zip/ZipFile [v9]

2024-01-02 Thread Eirik Bjørsnøs
sted. > > `StreamZipEntriesTest.java` > This test was using TestNG so was converted to JUnit for consistency. Added > some comments to help understanding. > > `ReadAfterClose.java` > This uses the binary test vector `crash.jar`. The test is converted to JUnit > and moved to `Re

Re: RFR: 8322802: Add testing for ZipFile.getEntry respecting the 'Language encoding' flag [v4]

2024-01-02 Thread Eirik Bjørsnøs
On Tue, 2 Jan 2024 16:43:29 GMT, Lance Andersen wrote: >> Eirik Bjørsnøs has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Add more cases for 'language encoding' bit set, opened with a different >

Re: RFR: 8322802: Add testing for ZipFile.getEntry respecting the 'Language encoding' flag [v5]

2024-01-02 Thread Eirik Bjørsnøs
erify the `Language encoding flag` condition for > `ZipFile.getEntry`. > > Testing: Verified that the test indeed fails when > `ZipFile.Source.getEntryPos` is updated to use the ZipFile's ZipCoder as > suggested above. Eirik Bjørsnøs has updated the pull request increment

  1   2   3   4   5   6   >