Changing the default file system provider is broken :(
Peter Levart
peter.levart at gmail.com
Sat Apr 22 20:48:43 UTC 2017
On 04/22/2017 10:06 PM, forax at univ-mlv.fr wrote:
>
> Or this might work too:
>
> http://cr.openjdk.java.net/~plevart/jdk9-dev/Path.toFile/webrev.01/
>
>
> yes, it's better
>
>
>
> A variant of this might be for FileSystems.getDefault() to start
> returning the custom default filesystem as soon as initLevel
> reaches 2 (after module system is initialized). This might allow
> custom default file system to be effective even before the VM is
> fully booted (for custom security manager or system class loader
> or java agent to already take advantage of it). But that probably
> would mean that the custom default filesystem loading logic would
> have to be modified in order to cope with system class loader not
> being setup already - it could use the builtin app class loader
> for locating and loading the classes...
>
> Do you happen to have a custom default filesystem to try this with?
>
>
> sure, a dummy one that delegates everything to the builtin
> https://gist.github.com/forax/615828b41c33eccda33afdf2eba1db87
Well, it works at least when
-Djava.nio.file.spi.DefaultFileSystemProvider=... is specified on the
command line. But when the system property is set as 1st thing in main()
method, it is already too late. It seems that after boot sequence is
finished (VM.isBooted() == true)and before main() method is called, some
code needs the FileSystem again, so default file system is already
initialized before the main() is executed.
Perhaps there needs to be another initLevel which would be set just
before the invocation of the main() method?
Regards, Peter
More information about the jigsaw-dev
mailing list