mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8242292: (fs) FileSystems.getFileSystem(URI) should throw IAE if the URI scheme is null
Reviewed-by: lancea, alanb
This commit is contained in:
parent
83a1d70f0f
commit
447d6499f1
2 changed files with 25 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -226,6 +226,9 @@ public final class FileSystems {
|
|||
*/
|
||||
public static FileSystem getFileSystem(URI uri) {
|
||||
String scheme = uri.getScheme();
|
||||
if (scheme == null) {
|
||||
throw new IllegalArgumentException(uri.toString());
|
||||
}
|
||||
for (FileSystemProvider provider: FileSystemProvider.installedProviders()) {
|
||||
if (scheme.equalsIgnoreCase(provider.getScheme())) {
|
||||
return provider.getFileSystem(uri);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue