RFR: 8370775: ModulePatcher$JarResourceFinder.getByteBuffer() does not close the InputStream after reading the bytes

Alan Bateman alanb at openjdk.org
Tue Oct 28 10:11:12 UTC 2025


On Tue, 28 Oct 2025 09:59:58 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> Can I please get a review of this code which closes the `InputStream` upon usage in `ModulePatcher$JarResourceFinder.getByteBuffer()`?
> 
> As noted in https://bugs.openjdk.org/browse/JDK-8370775, this is a minor clean up to this part of the code.
> 
> tier testing is currently in progress with this change.

src/java.base/share/classes/jdk/internal/module/ModulePatcher.java line 470:

> 468:                 @Override
> 469:                 public ByteBuffer getByteBuffer() throws IOException {
> 470:                     try (InputStream is = getInputStream()) {

Can you rename "is" to "in", only because "is" isn't a great name.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28014#discussion_r2468863392


More information about the core-libs-dev mailing list