Which two scenarios throw FileSystemNotFoundException when the paths.get(URI) method is invoked?

Which two scenarios throw FileSystemNotFoundException when the paths.get(URI) method is invoked?

Which two scenarios throw FileSystemNotFoundException when the paths.get(URI) method is invoked?

A.
When preconditions on the uri parameter do not hold

B.
When the provider identified by the URI�S scheme component is not installed

C.
When a security manager is installed and it denies an unspecified permission to acess the file system.

D.
When the file system identified by the uri does not exist and cannot be created automatically

E.
When the path string cannot be converted to a Path

Explanation:
The file system, identified by the URI, does not exist and cannot be created automatically, or the provider identified by the URI’s scheme component is not installed.
Note: This method converts the given URI to a Path object.
It throws the following exceptions:
*IllegalArgumentException – if preconditions on the uri parameter do not hold. The format of the URI is provider specific.
*FileSystemNotFoundException – The file system, identified by the URI, does not exist and cannot be created automatically, or the provider identified by the URI’s scheme component is not installed *SecurityException – if a security manager is installed and it denies an unspecified permission to access the file system
Reference: java.nio.file.Paths



Leave a Reply 0

Your email address will not be published. Required fields are marked *