RFR: 8322256: Define and document GZIPInputStream concatenated stream semantics

Eirik Bjørsnøs eirbjo at openjdk.org
Fri Aug 30 10:31:48 UTC 2024


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 the API  specification.
*  Any additional bytes following a trailer which do not form a valid header are discarded and the stream behaves as if the end of stream has been reached. This behavior is not documented in the API  specification.

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.

-------------

Commit messages:
 - Adjusting line breaks
 - Reduce the focus on technical details of the GZIP file format
 - Keep references to header and trailer in the order of appearance in the file format
 - Various cleanups in the test code
 - Shorten the note explaining concatenated GZIP stream behavior
 - Merge branch 'master' into JDK-8322256
 - Shorten the description of concatenation behavior per review comments.
 - Revert all functional changes, leaving only tests & Javadoc.
 - Refactor to eliminate "lenient" mode (still failng test: GZIPInZip.java).
 - Add GZIP input test for various gzip(1) command outputs.
 - ... and 16 more: https://git.openjdk.org/jdk/compare/5671f836...fc2b57e6

Changes: https://git.openjdk.org/jdk/pull/20787/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20787&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8322256
  Stats: 306 lines in 3 files changed: 306 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/20787.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20787/head:pull/20787

PR: https://git.openjdk.org/jdk/pull/20787


More information about the core-libs-dev mailing list