java.nio.file.FileSystemAlreadyExistsException Java Examples
The following examples show how to use
java.nio.file.FileSystemAlreadyExistsException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: dragonwell8_jdk Author: alibaba File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #2
Source Project: dragonwell8_jdk Author: alibaba File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } checkUri(uri); synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(null); delegate = result; return result; } }
Example #3
Source Project: TencentKona-8 Author: Tencent File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #4
Source Project: TencentKona-8 Author: Tencent File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } checkUri(uri); synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(null); delegate = result; return result; } }
Example #5
Source Project: jdk8u60 Author: chenghanpeng File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #6
Source Project: jdk8u60 Author: chenghanpeng File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } checkUri(uri); synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(null); delegate = result; return result; } }
Example #7
Source Project: openjdk-jdk8u Author: AdoptOpenJDK File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #8
Source Project: openjdk-jdk8u Author: AdoptOpenJDK File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } checkUri(uri); synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(null); delegate = result; return result; } }
Example #9
Source Project: Selenium-Foundation Author: Nordstrom File: AbstractSeleniumConfig.java License: Apache License 2.0 | 6 votes |
/** * Get the URI of the specified configuration file from its resolved URL. * * @param path configuration file path (absolute, relative, or simple filename) * @param url resolved configuration file URL * @return resolved configuration file URI * @throws URISyntaxException if specified URL is invalid * @throws IOException on failure to construct file system or extract configuration file */ private static URI getConfigUri(final String path, final URL url) throws URISyntaxException, IOException { URI uri = url.toURI(); if ("jar".equals(uri.getScheme())) { try { FileSystems.newFileSystem(uri, Collections.<String, Object>emptyMap()); } catch (FileSystemAlreadyExistsException eaten) { //NOSONAR LOGGER.warn("Specified file system already exists: {}", eaten.getMessage()); } String outputDir = PathUtils.getBaseDir(); File outputFile = new File(outputDir, path); Path outputPath = outputFile.toPath(); if (!outputPath.toFile().exists()) { Files.copy(Paths.get(uri), outputPath); } uri = outputPath.toUri(); } return uri; }
Example #10
Source Project: openjdk-jdk8u-backup Author: AdoptOpenJDK File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #11
Source Project: openjdk-jdk8u-backup Author: AdoptOpenJDK File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } checkUri(uri); synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(null); delegate = result; return result; } }
Example #12
Source Project: openjdk-jdk9 Author: AdoptOpenJDK File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #13
Source Project: openjdk-jdk9 Author: AdoptOpenJDK File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } checkUri(uri); synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(null); delegate = result; return result; } }
Example #14
Source Project: jdk8u-jdk Author: lambdalab-mirror File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #15
Source Project: jdk8u-jdk Author: lambdalab-mirror File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } checkUri(uri); synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(null); delegate = result; return result; } }
Example #16
Source Project: hottub Author: dsrg-uoft File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #17
Source Project: hottub Author: dsrg-uoft File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } checkUri(uri); synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(null); delegate = result; return result; } }
Example #18
Source Project: openjdk-8-source Author: keerath File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #19
Source Project: openjdk-8-source Author: keerath File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } checkUri(uri); synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(null); delegate = result; return result; } }
Example #20
Source Project: mycore Author: MyCoRe-Org File: MCRIView2Tools.java License: GNU General Public License v3.0 | 6 votes |
public static FileSystem getFileSystem(Path iviewFile) throws IOException { URI uri = URI.create("jar:" + iviewFile.toUri()); try { return FileSystems.newFileSystem(uri, Collections.emptyMap(), MCRClassTools.getClassLoader()); } catch (FileSystemAlreadyExistsException exc) { // block until file system is closed try { FileSystem fileSystem = FileSystems.getFileSystem(uri); while (fileSystem.isOpen()) { try { Thread.sleep(10); } catch (InterruptedException ie) { // get out of here throw new IOException(ie); } } } catch (FileSystemNotFoundException fsnfe) { // seems closed now -> do nothing and try to return the file system again LOGGER.debug("Filesystem not found", fsnfe); } return getFileSystem(iviewFile); } }
Example #21
Source Project: sftp-fs Author: robtimus File: SFTPFileSystemProvider.java License: Apache License 2.0 | 6 votes |
/** * Constructs a new {@code FileSystem} object identified by a URI. * <p> * The URI must have a {@link URI#getScheme() scheme} equal to {@link #getScheme()}, and no {@link URI#getUserInfo() user information}, * {@link URI#getPath() path}, {@link URI#getQuery() query} or {@link URI#getFragment() fragment}. Authentication credentials must be set through * the given environment map, preferably through {@link SFTPEnvironment}. * <p> * This provider allows multiple file systems per host, but only one file system per user on a host. * Once a file system is {@link FileSystem#close() closed}, this provider allows a new file system to be created with the same URI and credentials * as the closed file system. */ @Override @SuppressWarnings("resource") public FileSystem newFileSystem(URI uri, Map<String, ?> env) throws IOException { // user info must come from the environment map checkURI(uri, false, false); SFTPEnvironment environment = wrapEnvironment(env); String username = environment.getUsername(); URI normalizedURI = normalizeWithUsername(uri, username); synchronized (fileSystems) { if (fileSystems.containsKey(normalizedURI)) { throw new FileSystemAlreadyExistsException(normalizedURI.toString()); } SFTPFileSystem fs = new SFTPFileSystem(this, normalizedURI, environment); fileSystems.put(normalizedURI, fs); return fs; } }
Example #22
Source Project: openjdk-8 Author: bpupadhyaya File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #23
Source Project: openjdk-8 Author: bpupadhyaya File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } checkUri(uri); synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(null); delegate = result; return result; } }
Example #24
Source Project: jdk8u_jdk Author: JetBrains File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #25
Source Project: jdk8u_jdk Author: JetBrains File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } checkUri(uri); synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(null); delegate = result; return result; } }
Example #26
Source Project: che Author: eclipse File: IoUtil.java License: Eclipse Public License 2.0 | 6 votes |
/** * Lists all children resources. * * @param parent the root path represented in {@link URI} format * @param consumer consumer for children resources * @throws java.io.IOException if any i/o error occur * @throws ProviderNotFoundException if a provider supporting the URI scheme is not installed */ public static void listResources(URI parent, Consumer<Path> consumer) throws IOException { FileSystem fileSystem = null; try { if (!"file".equals(parent.getScheme())) { try { fileSystem = FileSystems.newFileSystem(parent, Collections.emptyMap()); } catch (FileSystemAlreadyExistsException ignore) { } } Path root = Paths.get(parent); Files.list(root).forEach(consumer); } finally { // close FS only if only it has been initialized here if (fileSystem != null) { fileSystem.close(); } } }
Example #27
Source Project: jdk8u-jdk Author: frohoff File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #28
Source Project: jdk8u-jdk Author: frohoff File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } checkUri(uri); synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(null); delegate = result; return result; } }
Example #29
Source Project: jdk8u-dev-jdk Author: frohoff File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #30
Source Project: jdk8u-dev-jdk Author: frohoff File: FaultyFileSystem.java License: GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } checkUri(uri); synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(null); delegate = result; return result; } }