HADOOP-14211. FilterFs and ChRootedFs are too aggressive about enforcing 'authorityNeeded'. Contributed by Erik Krogen.
(cherry picked from commit 0e556a5ba6
)
This commit is contained in:
parent
14414705f7
commit
96fe940e59
|
@ -57,8 +57,7 @@ public abstract class FilterFs extends AbstractFileSystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected FilterFs(AbstractFileSystem fs) throws URISyntaxException {
|
protected FilterFs(AbstractFileSystem fs) throws URISyntaxException {
|
||||||
super(fs.getUri(), fs.getUri().getScheme(),
|
super(fs.getUri(), fs.getUri().getScheme(), false, fs.getUriDefaultPort());
|
||||||
fs.getUri().getAuthority() != null, fs.getUriDefaultPort());
|
|
||||||
myFs = fs;
|
myFs = fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,8 +101,7 @@ class ChRootedFs extends AbstractFileSystem {
|
||||||
|
|
||||||
public ChRootedFs(final AbstractFileSystem fs, final Path theRoot)
|
public ChRootedFs(final AbstractFileSystem fs, final Path theRoot)
|
||||||
throws URISyntaxException {
|
throws URISyntaxException {
|
||||||
super(fs.getUri(), fs.getUri().getScheme(),
|
super(fs.getUri(), fs.getUri().getScheme(), false, fs.getUriDefaultPort());
|
||||||
fs.getUri().getAuthority() != null, fs.getUriDefaultPort());
|
|
||||||
myFs = fs;
|
myFs = fs;
|
||||||
myFs.checkPath(theRoot);
|
myFs.checkPath(theRoot);
|
||||||
chRootPathPart = new Path(myFs.getUriPath(theRoot));
|
chRootPathPart = new Path(myFs.getUriPath(theRoot));
|
||||||
|
|
|
@ -25,6 +25,8 @@ import java.util.Iterator;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
import org.apache.hadoop.fs.viewfs.ConfigUtil;
|
||||||
|
|
||||||
public class TestFilterFs extends TestCase {
|
public class TestFilterFs extends TestCase {
|
||||||
|
|
||||||
|
@ -65,4 +67,14 @@ public class TestFilterFs extends TestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test that FilterFs will accept an AbstractFileSystem to be filtered which
|
||||||
|
// has an optional authority, such as ViewFs
|
||||||
|
public void testFilteringWithNonrequiredAuthority() throws Exception {
|
||||||
|
Configuration conf = new Configuration();
|
||||||
|
ConfigUtil.addLink(conf, "custom", "/mnt", URI.create("file:///"));
|
||||||
|
FileContext fc =
|
||||||
|
FileContext.getFileContext(URI.create("viewfs://custom/"), conf);
|
||||||
|
new FilterFs(fc.getDefaultFileSystem()) {};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue