On Wed, 7 Jan 2026 13:47:24 GMT, Alan Bateman <[email protected]> wrote:
>> Jaikiran Pai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> use -1 to represent absence of a GZIP header, from readHeader() method > > src/java.base/share/classes/java/util/zip/GZIPInputStream.java line 195: > >> 193: * If failOnEOF is false and if the given InputStream has already >> 194: * reached EOF when this method was invoked, then this method >> returns >> 195: * 0 (indicating that there's no GZIP member header). > > Have you tried using -1 for EOF instead of 0? I think would make it easier to > understand at the use sites. I had very briefly considered it, but there was a call site (within this class) which was doing: m += readHeader(in); so I decided to use `0` to prevent accidental additions of negative value. Having said that, that is no longer a concern with the current changes in this PR and there are only 2 call sites to this (private) method in this class. So your suggestion of using `-1` as a return value sounds good to me. I've updated the PR accordingly. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29092#discussion_r2668587977
