On Sun, 12 Jul 2026 17:08:13 GMT, Volker Simonis <[email protected]> wrote:

>> [JDK-8385924: GZIPInputStream.read() behaves differently on some Java 
>> versions](https://bugs.openjdk.org/browse/JDK-8385924) introduced the new 
>> system property `jdk.util.gzip.tryReadAheadAfterTrailer` which defaults to 
>> `false` and restores the behavior of `GZIPInputStream` when reading 
>> multi-member gzip streams to the before-JDK25 (and JDK 27+) state. When the 
>> property is set to `true`, GZIPInputStream will behave like in JDK 25.
>> 
>> Currently, some of the new `GZIPInputStream` JTreg tests which specifically 
>> test the non-blocking behavior of `GZIPInputStream` rely on the fact that 
>> `jdk.util.gzip.tryReadAheadAfterTrailer` is set to `false`.
>> 
>> We should make testing more resilient and allow testing with 
>> `jdk.util.gzip.tryReadAheadAfterTrailer=true` without errors or timeouts.
>> 
>> Tested with:
>> - `make test TEST=test/jdk/java/util/zip/GZIP 
>> JTREG="OPTIONS=-javaoption:-Djdk.util.gzip.tryReadAheadAfterTrailer=false"`
>> - `make test TEST=test/jdk/java/util/zip/GZIP 
>> JTREG="OPTIONS=-javaoption:-Djdk.util.gzip.tryReadAheadAfterTrailer=true"`
>> 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Volker Simonis has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Fix tests to directly read 'GZIPInputStream.alwaysReadNextMember' instead 
> of relying on the system property 'jdk.util.gzip.tryReadAheadAfterTrailer'

Hello Volker, I had a look at this today. The goal of adding additional 
coverage in these 2 tests for the always read-ahead vs 
`InputStream.available()` call is a good idea. However, peeking into an 
internal implementation field to determine how the `GZIPInputStream` should 
behave wouldn't be appropriate here. Since the behaviour of `GZIPInputStream` 
is specified to depend on the `jdk.util.gzip.tryReadAheadAfterTrailer` system 
property, I think these 2 tests should test the behaviour against that property 
value. 

> We do this by downporting 8385924: GZIPInputStream.read() behaves differently 
> on some Java versions, but with GZIPInputStream.alwaysReadNextMember 
> defaulting to true. 

That's a source change to `GZIPInputStream` itself. I think testing for that 
behaviour should reside in the vendor specific repository, just like that 
source change itself.

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

PR Comment: https://git.openjdk.org/jdk/pull/31790#issuecomment-5001826975

Reply via email to