Summary
Add a throws clause for IllegalArgumentException
to the java.nio.file.FileSystems
methods newFileSystem(Path, Map)
and newFileSystem(Path, Map, ClassLoader)
. Also update the equivalent IAE verbiage for the analogous methods which accept a URI
parameter instead of a Path
.
Problem
The java.nio.file.FileSystems
methods newFileSystem(Path, Map)
and newFileSystem(Path, Map, ClassLoader)
can throw an IllegalArgumentException
but this is not made clear in the specification.
Solution
Add a throws clause for IllegalArgumentException
to the methods FileSystems.newFileSystem(Path, Map[, ClassLoader])
and update the verbiage of FileSystems.newFileSystem(URI, Map[, ClassLoader])
to be clearer and to match.
Specification
--- a/src/java.base/share/classes/java/nio/file/FileSystems.java
+++ b/src/java.base/share/classes/java/nio/file/FileSystems.java
@@ -257,8 +257,9 @@ public static FileSystem getFileSystem(URI uri) {
*
* @throws IllegalArgumentException
* if the pre-conditions for the {@code uri} parameter are not met,
- * or the {@code env} parameter does not contain properties required
- * by the provider, or a property value is invalid
+ * or if the {@code env} parameter does not contain properties
+ * required by the provider, contains an invalid combination of
+ * properties and values, or contains an invalid property value
* @throws FileSystemAlreadyExistsException
* if the file system has already been created
* @throws ProviderNotFoundException
@@ -296,8 +297,9 @@ public static FileSystem newFileSystem(URI uri, Map<String,?> env)
*
* @throws IllegalArgumentException
* if the pre-conditions for the {@code uri} parameter are not met,
- * or the {@code env} parameter does not contain properties required
- * by the provider, or a property value is invalid
+ * or if the {@code env} parameter does not contain properties
+ * required by the provider, contains an invalid combination of
+ * properties and values, or contains an invalid property value
* @throws FileSystemAlreadyExistsException
* if the URI scheme identifies an installed provider and the file
* system has already been created
@@ -370,6 +372,8 @@ public static FileSystem newFileSystem(URI uri, Map<String,?> env, ClassLoader l
* when an error occurs while loading a service provider
* @throws IOException
* if an I/O error occurs
+ *
+ * @since 13
*/
public static FileSystem newFileSystem(Path path,
ClassLoader loader)
@@ -400,6 +404,10 @@ public static FileSystem newFileSystem(Path path,
*
* @return a new file system
*
+ * @throws IllegalArgumentException
+ * if the {@code env} parameter does not contain properties
+ * required by the provider, contains an invalid combination of
+ * properties and values, or contains an invalid property value
* @throws ProviderNotFoundException
* if a provider supporting this file type cannot be located
* @throws ServiceConfigurationError
@@ -476,6 +484,10 @@ public static FileSystem newFileSystem(Path path) throws IOException {
*
* @return a new file system
*
+ * @throws IllegalArgumentException
+ * if the {@code env} parameter does not contain properties
+ * required by the provider, contains an invalid combination of
+ * properties and values, or contains an invalid property value
* @throws ProviderNotFoundException
* if a provider supporting this file type cannot be located
* @throws ServiceConfigurationError
- csr of
-
JDK-8356888 (fs) FileSystems.newFileSystem that take an env must specify IllegalArgumentException
-
- Resolved
-