src/java.base/share/classes/java/nio/file/FileSystems.java

Print this page
rev 12500 : 8132497: (fs) FileSystems.newFileSystem(URI, ..) doesn't handle UOE thrown by provider
Summary: Handle UOEs in newFileSystem(URI,...) similarly to as done in newFileSystem(Path path, ClassLoader loader).
Reviewed-by: XXX

*** 1,7 **** /* ! * Copyright (c) 2007, 2013, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2007, 2015, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 319,341 **** throws IOException { String scheme = uri.getScheme(); // check installed providers ! for (FileSystemProvider provider: FileSystemProvider.installedProviders()) { if (scheme.equalsIgnoreCase(provider.getScheme())) { return provider.newFileSystem(uri, env); } } // if not found, use service-provider loading facility if (loader != null) { ServiceLoader<FileSystemProvider> sl = ServiceLoader .load(FileSystemProvider.class, loader); ! for (FileSystemProvider provider: sl) { if (scheme.equalsIgnoreCase(provider.getScheme())) { return provider.newFileSystem(uri, env); } } } throw new ProviderNotFoundException("Provider \"" + scheme + "\" not found"); --- 319,347 ---- throws IOException { String scheme = uri.getScheme(); // check installed providers ! for (FileSystemProvider provider : FileSystemProvider.installedProviders()) { if (scheme.equalsIgnoreCase(provider.getScheme())) { + try { return provider.newFileSystem(uri, env); + } catch (UnsupportedOperationException uoe) { + } } } // if not found, use service-provider loading facility if (loader != null) { ServiceLoader<FileSystemProvider> sl = ServiceLoader .load(FileSystemProvider.class, loader); ! for (FileSystemProvider provider : sl) { if (scheme.equalsIgnoreCase(provider.getScheme())) { + try { return provider.newFileSystem(uri, env); + } catch (UnsupportedOperationException uoe) { + } } } } throw new ProviderNotFoundException("Provider \"" + scheme + "\" not found");