RFR: 8349907: jdk.tools.jlink.internal.plugins.ZipPlugin does not close the Deflater in exceptional cases [v2]
Jaikiran Pai
jpai at openjdk.org
Wed Feb 12 15:45:27 UTC 2025
On Wed, 12 Feb 2025 15:39:11 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Lance's suggestion
>
> src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java line 99:
>
>> 97: stream.close();
>> 98: } catch (IOException ex) {
>> 99: return bytesIn; // return the original uncompressed input
>
> This really won't happen. The close for byte array in/out streams are no-op and can be omitted. I believe putting an assertion here is better too.
>
> And by practice, calling methods on an in/out stream after close doesn't make much sense too. Here we are calling `toByteArray` after close, which looks weird.
Hello Chen, after Lance suggested a similar change, I've updated the PR and with that update this `stream.close()` is no longer explicitly done.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23588#discussion_r1952909253
More information about the core-libs-dev
mailing list