RFR: 8210471: GZIPInputStream constructor could leak an un-end()ed Inflater [v2]

Jaikiran Pai jai.forums2013 at gmail.com
Fri May 31 01:22:10 UTC 2024


Now that you mentioned it was added in Java 23, I went back to check 
what change brought that in. Turns out it was me who introduced it, that 
too as recently as a few months back. I too had forgotten about it :)

-Jaikiran

On 31/05/24 6:40 am, Lance Andersen wrote:
> I was looking at jdk 22 and now see the npe was added to the constructor specification earlier this year and I reviewed it🙈
> Sent from my iPad
>
>> On May 30, 2024, at 8:56 PM, Jaikiran Pai <jpai at openjdk.org> wrote:
>>
>> On Thu, 30 May 2024 14:56:00 GMT, Lance Andersen <lancea at openjdk.org> wrote:
>>
>>>> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
>>>>
>>>>   introduce a basic test for GZIPInputStream
>>> src/java.base/share/classes/java/util/zip/GZIPInputStream.java line 97:
>>>
>>>> 95:      */
>>>> 96:     private static Inflater createInflater(InputStream in, int size) {
>>>> 97:         Objects.requireNonNull(in);
>>> I don't believe we currently indicate at at NPE will be thrown if the InputStream is null so this would require a CSR if we need to document it
>> Hello Lance, both the constructors of `GZIPInputStream` already state that they throw a NullPointerException when the input stream is null:
>>
>>
>>      * @throws    NullPointerException if {@code in} is null
>>
>> It was already being thrown from within the super constructor. To prevent creation of a `Inflater` when `in` is null, I had to add this check here.
>>
>> -------------
>>
>> PR Review Comment: https://git.openjdk.org/jdk/pull/19475#discussion_r1621554479


More information about the core-libs-dev mailing list