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 File: FaultyFileSystem.java From jdk8u_jdk with 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 File: FaultyFileSystem.java From hottub with 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 #3
Source File: FaultyFileSystem.java From hottub with 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 #4
Source File: FaultyFileSystem.java From openjdk-8-source with 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 #5
Source File: FaultyFileSystem.java From openjdk-8-source with 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 #6
Source File: MCRIView2Tools.java From mycore with 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 #7
Source File: SFTPFileSystemProvider.java From sftp-fs with 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 #8
Source File: FaultyFileSystem.java From openjdk-8 with 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 #9
Source File: FaultyFileSystem.java From openjdk-8 with 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 #10
Source File: FaultyFileSystem.java From dragonwell8_jdk with 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 #11
Source File: FaultyFileSystem.java From jdk8u_jdk with 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 File: IoUtil.java From che with 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 #13
Source File: FaultyFileSystem.java From jdk8u-jdk with 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 #14
Source File: FaultyFileSystem.java From jdk8u-jdk with 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 #15
Source File: FaultyFileSystem.java From jdk8u-dev-jdk with 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 #16
Source File: FaultyFileSystem.java From jdk8u-dev-jdk with 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 #17
Source File: SystemJimfsFileSystemProvider.java From jimfs with Apache License 2.0 | 6 votes |
@Override public FileSystem newFileSystem(URI uri, Map<String, ?> env) throws IOException { checkArgument( uri.getScheme().equalsIgnoreCase(URI_SCHEME), "uri (%s) scheme must be '%s'", uri, URI_SCHEME); checkArgument( isValidFileSystemUri(uri), "uri (%s) may not have a path, query or fragment", uri); checkArgument( env.get(FILE_SYSTEM_KEY) instanceof FileSystem, "env map (%s) must contain key '%s' mapped to an instance of %s", env, FILE_SYSTEM_KEY, FileSystem.class); FileSystem fileSystem = (FileSystem) env.get(FILE_SYSTEM_KEY); if (fileSystems.putIfAbsent(uri, fileSystem) != null) { throw new FileSystemAlreadyExistsException(uri.toString()); } return fileSystem; }
Example #18
Source File: FaultyFileSystem.java From jdk8u-jdk with 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 File: FaultyFileSystem.java From dragonwell8_jdk with 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 #20
Source File: FaultyFileSystem.java From TencentKona-8 with 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 #21
Source File: FaultyFileSystem.java From TencentKona-8 with 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 #22
Source File: FaultyFileSystem.java From jdk8u60 with 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 File: FaultyFileSystem.java From jdk8u60 with 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 File: FaultyFileSystem.java From openjdk-jdk8u with 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 File: FaultyFileSystem.java From openjdk-jdk8u with 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 File: AbstractSeleniumConfig.java From Selenium-Foundation with 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 #27
Source File: FaultyFileSystem.java From openjdk-jdk8u-backup with 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 File: FaultyFileSystem.java From jdk8u-jdk with 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 File: FaultyFileSystem.java From openjdk-jdk9 with 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 #30
Source File: FaultyFileSystem.java From openjdk-jdk9 with 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; } }