Integrated: 8346573: Can't use custom default file system provider with custom system class loader

Alan Bateman alanb at openjdk.org
Tue Jan 7 10:37:52 UTC 2025


On Fri, 20 Dec 2024 09:47:32 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> If an application is deployed to use a custom default file system provider, and a custom system class loader, and initialisation of the custom system class loader uses the file system APIs, then it leads to a recursive initialisation issue. This issue has always existed but has only recently been reported. Using both configuration knobs at the same time is probably very rare but it does require attention in advance of any proposals that re-implement the java.io file classes on java.nio.file.
> 
> The proposed change here is to re-specify FileSystems.getDefault to use the default system class loader when locating the custom default file system provider. In spec terms, this is changing "system class loader" to "default system class loader" with a link to its meaning in ClassLoader.getSystemClassLoader. As part of the change I've expanded the wording to specify that the custom default file system provider must be public in a package exported to at least java.base, and that the one-arg constructor also be public. This additional clarification specifies long standing behavior and does not change any implementation.
> 
> The SetDefaultProvider.java test is expanded to add a new test the runs with both a custom default file system provider and custom system class loader, and where where the custom system class loader uses the file APIs in its initialisation.

This pull request has now been integrated.

Changeset: f1196638
Author:    Alan Bateman <alanb at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/f1196638b347c9a2e7d7dc1795c6c24ea7efe711
Stats:     72 lines in 3 files changed: 58 ins; 2 del; 12 mod

8346573: Can't use custom default file system provider with custom system class loader

Reviewed-by: mkartashev, bpb

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

PR: https://git.openjdk.org/jdk/pull/22842


More information about the nio-dev mailing list