JDK-8372787 : ModulePatcher$PatchedModuleReader throws unspecified IllegalStateException upon being invoked after close()
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.module
  • Affected Version: 9
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-12-01
  • Updated: 2025-12-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
Several methods on java.lang.module.ModuleReader are specified to thrown an IOException if invoked after the reader was closed:

> @throws IOException If an I/O error occurs or the module reader is closed

jdk.internal.module.ModulePatcher$PatchedModuleReader is an (internal) implementation of ModuleReader. Some of its methods throw an unspecified IllegalStateException when invoked after being closed:

Caused by: java.lang.IllegalStateException: zip file closed
    at java.base/java.util.zip.ZipFile.ensureOpen(ZipFile.java:827)
    at java.base/java.util.zip.ZipFile.getEntry(ZipFile.java:290)
    at java.base/java.util.jar.JarFile.getEntry(JarFile.java:505)
    at java.base/java.util.jar.JarFile.getJarEntry(JarFile.java:460)
    at java.base/jdk.internal.module.ModulePatcher$JarResourceFinder.find(ModulePatcher.java:444)
    at java.base/jdk.internal.module.ModulePatcher$PatchedModuleReader.findResourceInPatch(ModulePatcher.java:301)
    at java.base/jdk.internal.module.ModulePatcher$PatchedModuleReader.find(ModulePatcher.java:357)
Comments
The JAR files containing patches shouldn't be closed so need to find out the conditions where this arises.
01-12-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/28569 Date: 2025-12-01 06:08:00 +0000
01-12-2025