List of usage examples for java.nio.file ProviderMismatchException ProviderMismatchException
public ProviderMismatchException()
From source file:de.tiqsolutions.hdfs.HadoopFileSystemProvider.java
@Override public void move(Path source, Path target, CopyOption... options) throws IOException { FileSystem fs = source.getFileSystem(); if (!HadoopFileSystem.class.isInstance(fs)) throw new IllegalArgumentException("source"); if (!fs.provider().equals(target.getFileSystem().provider())) throw new ProviderMismatchException(); List<Rename> renameOptions = new ArrayList<>(); List<CopyOption> copyOptions = Arrays.asList(options); if (copyOptions.contains(StandardCopyOption.REPLACE_EXISTING)) renameOptions.add(Rename.OVERWRITE); try {/*from w w w .j a v a 2 s .c om*/ ((HadoopFileSystem) fs).getFileContext().rename(((HadoopFileSystemPath) source).getPath(), ((HadoopFileSystemPath) target).getPath(), renameOptions.toArray(new Rename[renameOptions.size()])); } catch (RemoteException e) { rethrowRemoteException(e, source, target); } }
From source file:nextflow.fs.dx.DxFileSystemProvider.java
static final DxPath toDxPath(Path path) { if (path == null) { throw new NullPointerException(); }/*w w w . j av a2s . c o m*/ if (!(path instanceof DxPath)) { throw new ProviderMismatchException(); } return (DxPath) path; }