RFR: 8331467: ImageReaderFactory can cause a ClassNotFoundException if the default FileSystemProvider is not the system-default provider
Alan Bateman
alanb at openjdk.org
Sat Nov 9 09:00:52 UTC 2024
On Sat, 9 Nov 2024 02:18:22 GMT, jyxzwd <duke at openjdk.org> wrote:
> Use the built-in file system provider rather than the custom file system provider.
> Add "public static FileSystemProvider create" method in DefaultFileSystemProvider which is from java8API to be compatible against runtime.
src/java.base/share/classes/jdk/internal/jimage/ImageReaderFactory.java line 51:
> 49: private static final String JAVA_HOME = System.getProperty("java.home");
> 50: private static final Path BOOT_MODULES_JIMAGE =
> 51: sun.nio.fs.DefaultFileSystemProvider.create().getPath(JAVA_HOME, "lib", "modules");
This is JDK internal so if the classes in jrt-fs.jar are loaded by a custom class loader, in for example JDK 17 or 21, then this will fail.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21997#discussion_r1835320287
More information about the core-libs-dev
mailing list