RFR: 8210471: GZIPInputStream constructor could leak an un-end()ed Inflater [v2]
Jaikiran Pai
jpai at openjdk.org
Fri May 31 00:56:01 UTC 2024
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