Why does Path check for the Default FileSystem?
Alan Bateman
Alan.Bateman at oracle.com
Wed Mar 24 08:49:32 UTC 2021
On 23/03/2021 18:57, Michael Hall wrote:
> :
>
> No, that doesn’t do it either. It seems to get back to the
> ClassNotFoundException without the jar after getting into the Path code?
>
> at
> java.base/java.nio.file.FileSystems$DefaultFileSystemHolder.getDefaultProvider(FileSystems.java:133)
> at
> java.base/java.nio.file.FileSystems$DefaultFileSystemHolder$1.run(FileSystems.java:102)
> at
> java.base/java.nio.file.FileSystems$DefaultFileSystemHolder$1.run(FileSystems.java:100)
> at
> java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
> at
> java.base/java.nio.file.FileSystems$DefaultFileSystemHolder.defaultFileSystem(FileSystems.java:100)
> at
> java.base/java.nio.file.FileSystems$DefaultFileSystemHolder.<clinit>(FileSystems.java:94)
> at java.base/java.nio.file.FileSystems.getDefault(FileSystems.java:182)
> at java.base/java.nio.file.Path.of(Path.java:147)
> at java.base/java.nio.file.Paths.get(Paths.java:69)
>
> Verbose class loading similar to before…
>
> [0.035s][info][class,load] java.lang.SecurityException source:
> jrt:/java.base
> Error: A JNI error has occurred, please check your installation and
> try again
> Exception in thread "main" [0.035s][info][class,load]
> java.lang.Throwable$PrintStreamOrWriter source: jrt:/java.base
> [0.035s][info][class,load] java.lang.Throwable$WrappedPrintStream
> source: jrt:/java.base
> [0.035s][info][class,load] java.util.IdentityHashMap source: shared
> objects file
> [0.035s][info][class,load] java.util.IdentityHashMap$KeySet source:
> shared objects file
> java.lang.Error: java.lang.ClassNotFoundException:
> us.hall.trz.osx.MacFileSystemProvider
>
> It would be nice if I knew the source of the SecurityException before
> it percolates out to the strange ClassNotFoundException’s
>
> My question as to why does it need to be only the DefaultProvider
> still remains? That still seems to totally defeat passthrough.
>
> https://docs.oracle.com/javase/8/docs/technotes/guides/io/fsp/filesystemprovider.html
> <https://docs.oracle.com/javase/8/docs/technotes/guides/io/fsp/filesystemprovider.html>
> • Replacing or supplementing the default file system provider. The
> custom provider can augment the default provider by performing
> specific operations, such as logging all system operations, and
> delegate to the default provider for other routine operations.
>
> This is what I am trying to do but the code doesn’t seem to allow
> delegating?
>
I just tried the TestProvider that we have in the test tree and it works
as the default file system provider when exploded on the file system
(not packaged as a JAR file on the class path as thee is an issue
there). I commented out the override of toFile() and it does the right
thing. So I'm not 100% sure how you are running into an issue, I think
we need something that reproduces it.
-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20210324/9823f580/attachment.htm>
More information about the nio-dev
mailing list