--- old/src/java.base/share/classes/java/nio/file/Paths.java 2018-03-07 17:30:58.000000000 -0800 +++ new/src/java.base/share/classes/java/nio/file/Paths.java 2018-03-07 17:30:57.000000000 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2018, 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 @@ -33,6 +33,7 @@ * by converting a path string or {@link URI}. * * @since 1.7 + * @see Path */ public final class Paths { @@ -68,6 +69,10 @@ * Path path = dir.resolve("file"); * * + * @implSpec + * This method simply invokes {@link Path#get(String,String...) + * Path.get(String, String...)} with the given parameters. + * * @param first * the path string or initial part of the path string * @param more @@ -79,9 +84,10 @@ * if the path string cannot be converted to a {@code Path} * * @see FileSystem#getPath + * @see Path#get(String,String...) */ public static Path get(String first, String... more) { - return FileSystems.getDefault().getPath(first, more); + return Path.get(first, more); } /** @@ -112,6 +118,10 @@ * Java virtual machine. Whether other providers make any guarantees is * provider specific and therefore unspecified. * + * @implSpec + *

This method simply invokes {@link Path#get(URI) + * Path.get(URI)} with the given parameter. + * * @param uri * the URI to convert * @@ -127,23 +137,10 @@ * @throws SecurityException * if a security manager is installed and it denies an unspecified * permission to access the file system + * + * @see Path#get(URI) */ public static Path get(URI uri) { - String scheme = uri.getScheme(); - if (scheme == null) - throw new IllegalArgumentException("Missing scheme"); - - // check for default provider to avoid loading of installed providers - if (scheme.equalsIgnoreCase("file")) - return FileSystems.getDefault().provider().getPath(uri); - - // try to find provider - for (FileSystemProvider provider: FileSystemProvider.installedProviders()) { - if (provider.getScheme().equalsIgnoreCase(scheme)) { - return provider.getPath(uri); - } - } - - throw new FileSystemNotFoundException("Provider \"" + scheme + "\" not installed"); + return Path.get(uri); } }