|
@@ -75,6 +75,7 @@ import org.apache.htrace.core.TraceScope;
|
|
|
|
|
|
import com.google.common.annotations.VisibleForTesting;
|
|
|
|
|
|
+import static com.google.common.base.Preconditions.checkArgument;
|
|
|
import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.*;
|
|
|
|
|
|
/****************************************************************
|
|
@@ -211,7 +212,13 @@ public abstract class FileSystem extends Configured implements Closeable {
|
|
|
* @param conf the configuration
|
|
|
*/
|
|
|
public void initialize(URI name, Configuration conf) throws IOException {
|
|
|
- statistics = getStatistics(name.getScheme(), getClass());
|
|
|
+ final String scheme;
|
|
|
+ if (name.getScheme() == null || name.getScheme().isEmpty()) {
|
|
|
+ scheme = getDefaultUri(conf).getScheme();
|
|
|
+ } else {
|
|
|
+ scheme = name.getScheme();
|
|
|
+ }
|
|
|
+ statistics = getStatistics(scheme, getClass());
|
|
|
resolveSymlinks = conf.getBoolean(
|
|
|
CommonConfigurationKeys.FS_CLIENT_RESOLVE_REMOTE_SYMLINKS_KEY,
|
|
|
CommonConfigurationKeys.FS_CLIENT_RESOLVE_REMOTE_SYMLINKS_DEFAULT);
|
|
@@ -3576,6 +3583,8 @@ public abstract class FileSystem extends Configured implements Closeable {
|
|
|
@Deprecated
|
|
|
public static synchronized Statistics getStatistics(final String scheme,
|
|
|
Class<? extends FileSystem> cls) {
|
|
|
+ checkArgument(scheme != null,
|
|
|
+ "No statistics is allowed for a file system with null scheme!");
|
|
|
Statistics result = statisticsTable.get(cls);
|
|
|
if (result == null) {
|
|
|
final Statistics newStats = new Statistics(scheme);
|