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

Lance Andersen lance.andersen at oracle.com
Fri May 31 01:10:05 UTC 2024


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