Changing the default file system provider is broken :(
Alan.Bateman at oracle.com
Sat Apr 22 20:26:59 UTC 2017
On 22/04/2017 12:20, Remi Forax wrote:
> Ooops !
> if you use the module path, you can not change the default system provider mechanism anymore,
> mostly because the module implementation internally uses java.nio.file.Path at different places.
> First, trying to initialize the default system provider in Java code do not work at all,
> System.setProperty("java.nio.file.spi.DefaultFileSystemProvider", "...");
> in a main does nothing because the jigsaw implementation has already loaded the default implementation to be able to inspect the modules.
> Then, if you try to use the command line
> you have various bootstrapping issues.
Sigh, this is a bug here. A custom default file system can't be used
during early startup so this is why the module system uses the built-in
implementation. The bug is that is should always derive paths and never
use Paths.get or toFile as that risks mixing paths from the built-in
file system provider with the custom provider. The patch to fix is
straight-forward and I'll get that in jake soon. The only change needed
in the file system code is that FileSystems.getDefault should use
VM.isModuleSystemInited() rather than is VM.booted() to allow for the
corner case that is a custom system class loader or custom security
manager using the file system API.
More information about the jigsaw-dev