类java.nio.file.FileSystemAlreadyExistsException源码实例Demo

下面列出了怎么用java.nio.file.FileSystemAlreadyExistsException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dragonwell8_jdk   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码2 项目: dragonwell8_jdk   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码3 项目: TencentKona-8   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码4 项目: TencentKona-8   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码5 项目: jdk8u60   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码6 项目: jdk8u60   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码7 项目: openjdk-jdk8u   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码8 项目: openjdk-jdk8u   文件: FaultyFileSystem.java
@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;
    }
}
 
/**
 * 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;
}
 
源代码10 项目: openjdk-jdk8u-backup   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码11 项目: openjdk-jdk8u-backup   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码12 项目: openjdk-jdk9   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码13 项目: openjdk-jdk9   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码14 项目: jdk8u-jdk   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码15 项目: jdk8u-jdk   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码16 项目: hottub   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码17 项目: hottub   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码18 项目: openjdk-8-source   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码19 项目: openjdk-8-source   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码20 项目: mycore   文件: MCRIView2Tools.java
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);
    }
}
 
源代码21 项目: sftp-fs   文件: SFTPFileSystemProvider.java
/**
 * 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;
    }
}
 
源代码22 项目: openjdk-8   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码23 项目: openjdk-8   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码24 项目: jdk8u_jdk   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码25 项目: jdk8u_jdk   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码26 项目: che   文件: IoUtil.java
/**
 * 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();
    }
  }
}
 
源代码27 项目: jdk8u-jdk   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码28 项目: jdk8u-jdk   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码29 项目: jdk8u-dev-jdk   文件: FaultyFileSystem.java
@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;
    }
}
 
源代码30 项目: jdk8u-dev-jdk   文件: FaultyFileSystem.java
@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;
    }
}
 
 类所在包
 同包方法