Java 类org.apache.hadoop.fs.FSError 实例源码
项目:dremio-oss
文件:TestFileSystemWrapperFSError.java
@Test
public void test() throws Exception {
assumeNonMaprProfile();
final IOException ioException = new IOException("test io exception");
final FSError fsError = newFSError(ioException);
FileSystem underlyingFS = mock(FileSystem.class, new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
if (!invocation.getMethod().getName().equals("getScheme")) {
throw fsError;
}
return "mockfs";
}
});
Configuration conf = new Configuration(false);
FileSystemWrapper fsw = new FileSystemWrapper(conf, underlyingFS, null);
Object[] params = FSErrorTestUtils.getDummyArguments(method);
try {
method.invoke(fsw, params);
} catch(InvocationTargetException e) {
assertThat(e.getTargetException(), is(instanceOf(IOException.class)));
assertThat((IOException) e.getTargetException(), is(sameInstance(ioException)));
}
}
项目:dremio-oss
文件:TestFSDataOutputStreamWrapper.java
@Test
public void test() throws Exception {
assumeNonMaprProfile();
final IOException ioException = new IOException("test io exception");
final FSError fsError = newFSError(ioException);
FSDataOutputStream fdos = mock(FSDataOutputStream.class, new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
throw fsError;
}
});
FSDataOutputStreamWrapper fdosw = new FSDataOutputStreamWrapper(fdos);
Object[] params = getDummyArguments(method);
try {
method.invoke(fdosw, params);
} catch(InvocationTargetException e) {
assertThat(e.getTargetException(), is(instanceOf(IOException.class)));
assertThat((IOException) e.getTargetException(), is(sameInstance(ioException)));
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
/**
* If OperatorStats are provided return a instrumented {@link org.apache.hadoop.fs.FSDataInputStream}.
*/
@Override
public FSDataInputStream open(Path f, int bufferSize) throws IOException {
try {
return newFSDataInputStreamWrapper(f, underlyingFs.open(f, bufferSize));
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
/**
* If OperatorStats are provided return a instrumented {@link org.apache.hadoop.fs.FSDataInputStream}.
*/
@Override
public FSDataInputStream open(Path f) throws IOException {
try {
return newFSDataInputStreamWrapper(f, underlyingFs.open(f));
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public void initialize(URI name, Configuration conf) throws IOException {
try {
underlyingFs.initialize(name, conf);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public FSDataOutputStream create(Path f) throws IOException {
try {
return newFSDataOutputStreamWrapper(underlyingFs.create(f));
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FSDataInputStreamWrapper.java
@Override
public int available() throws IOException {
try {
return underlyingIs.available();
} catch(FSError e) {
throw FileSystemWrapper.propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public FSDataOutputStream create(Path f, Progressable progress) throws IOException {
try {
return newFSDataOutputStreamWrapper(underlyingFs.create(f, progress));
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FSDataInputStreamWrapper.java
@Override
public synchronized void reset() throws IOException {
try {
is.reset();
} catch(FSError e) {
throw FileSystemWrapper.propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public FSDataOutputStream create(Path f, short replication, Progressable progress) throws IOException {
try {
return newFSDataOutputStreamWrapper(underlyingFs.create(f, replication, progress));
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public FSDataOutputStream create(Path f, boolean overwrite, int bufferSize) throws IOException {
try {
return newFSDataOutputStreamWrapper(underlyingFs.create(f, overwrite, bufferSize));
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public FSDataOutputStream create(Path f, boolean overwrite, int bufferSize, Progressable progress) throws IOException {
try {
return newFSDataOutputStreamWrapper(underlyingFs.create(f, overwrite, bufferSize, progress));
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public FSDataOutputStream create(Path f, boolean overwrite, int bufferSize, short replication,
long blockSize) throws IOException {
try {
return newFSDataOutputStreamWrapper(underlyingFs.create(f, overwrite, bufferSize, replication, blockSize));
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public FSDataOutputStream create(Path f, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException {
try {
return newFSDataOutputStreamWrapper(underlyingFs.create(f, overwrite, bufferSize, replication, blockSize, progress));
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public FileStatus getFileStatus(Path f) throws IOException {
try {
return underlyingFs.getFileStatus(f);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FSDataOutputStreamWrapper.java
@Override
public void hflush() throws IOException {
try {
underlyingOS.hflush();
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public FileStatus getFileLinkStatus(Path f) throws AccessControlException, FileNotFoundException,
UnsupportedFileSystemException, IOException {
try {
return underlyingFs.getFileLinkStatus(f);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FSDataInputStreamWrapper.java
@Override
public void readFully(long position, byte[] buffer, int offset, int length) throws IOException {
try {
underlyingIs.readFully(position, buffer, offset, length);
} catch(FSError e) {
throw FileSystemWrapper.propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public FileChecksum getFileChecksum(Path f) throws IOException {
try {
return underlyingFs.getFileChecksum(f);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FSDataOutputStreamWrapper.java
@Override
public long getPos() throws IOException {
try {
return underlyingOS.getPos();
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public FsStatus getStatus(Path p) throws IOException {
try {
return underlyingFs.getStatus(p);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public void setPermission(Path p, FsPermission permission) throws IOException {
try {
underlyingFs.setPermission(p, permission);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public Path createSnapshot(Path path, String snapshotName) throws IOException {
try {
return underlyingFs.createSnapshot(path, snapshotName);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public void renameSnapshot(Path path, String snapshotOldName, String snapshotNewName) throws IOException {
try {
underlyingFs.renameSnapshot(path, snapshotOldName, snapshotNewName);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public void deleteSnapshot(Path path, String snapshotName) throws IOException {
try {
underlyingFs.deleteSnapshot(path, snapshotName);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FSDataInputStreamWrapper.java
@Override
public void close() throws IOException {
try {
underlyingIs.close();
} catch(FSError e) {
throw FileSystemWrapper.propagateFSError(e);
}
}
项目:dremio-oss
文件:FSDataInputStreamWrapper.java
@Override
public void readFully(long position, byte[] buffer, int offset, int length) throws IOException {
try {
is.readFully(position, buffer, offset, length);
} catch(FSError e) {
throw FileSystemWrapper.propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public void removeDefaultAcl(Path path) throws IOException {
try {
underlyingFs.removeDefaultAcl(path);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FSDataInputStreamWrapper.java
@Override
public long getPos() throws IOException {
try {
return is.getPos();
} catch(FSError e) {
throw FileSystemWrapper.propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public AclStatus getAclStatus(Path path) throws IOException {
try {
return underlyingFs.getAclStatus(path);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
/**
* Canonicalizes a path if supported by the filesystem
*
* @param fs the filesystem to use
* @param path the path to canonicalize
* @return the canonicalized path, or the same path if not supported by the filesystem.
*
* @throws IOException
*/
public static Path canonicalizePath(FileSystem fs, Path path) throws IOException {
try {
if (fs instanceof PathCanonicalizer) {
return ((PathCanonicalizer) fs).canonicalizePath(path);
}
return path;
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FSDataInputStreamWrapper.java
@Override
public void readFully(long position, byte[] buffer) throws IOException {
try {
underlyingIs.readFully(position, buffer);
} catch(FSError e) {
throw FileSystemWrapper.propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
@Deprecated
public short getReplication(Path src) throws IOException {
try {
return underlyingFs.getReplication(src);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public boolean setReplication(Path src, short replication) throws IOException {
try {
return underlyingFs.setReplication(src, replication);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public boolean mkdirs(Path f, FsPermission permission) throws IOException {
try {
return underlyingFs.mkdirs(f, permission);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public void copyFromLocalFile(Path src, Path dst) throws IOException {
try {
underlyingFs.copyFromLocalFile(src, dst);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public void moveFromLocalFile(Path[] srcs, Path dst) throws IOException {
try {
underlyingFs.moveFromLocalFile(srcs, dst);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public void moveFromLocalFile(Path src, Path dst) throws IOException {
try {
underlyingFs.moveFromLocalFile(src, dst);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public void copyFromLocalFile(boolean delSrc, Path src, Path dst) throws IOException {
try {
underlyingFs.copyFromLocalFile(delSrc, src, dst);
} catch(FSError e) {
throw propagateFSError(e);
}
}
项目:dremio-oss
文件:FileSystemWrapper.java
@Override
public void copyFromLocalFile(boolean delSrc, boolean overwrite, Path[] srcs, Path dst) throws IOException {
try {
underlyingFs.copyFromLocalFile(delSrc, overwrite, srcs, dst);
} catch(FSError e) {
throw propagateFSError(e);
}
}