From 151e147e641cf51cd51db4c2ef7e76b45aed6bb3 Mon Sep 17 00:00:00 2001 From: Gera Shegalov Date: Fri, 30 Jan 2015 18:36:37 -0800 Subject: [PATCH] HADOOP-11432. Fix SymlinkBaseTest#testCreateLinkUsingPartQualPath2. (Liang Xie via gera) (cherry picked from commit 26c2de36e2dd1b2ddedc155e49fb2ec31366d5f8) --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../java/org/apache/hadoop/fs/AbstractFileSystem.java | 10 +++++++--- .../java/org/apache/hadoop/fs/SymlinkBaseTest.java | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index b36447747c1..32d42b3ffe2 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -449,6 +449,9 @@ Release 2.7.0 - UNRELEASED HADOOP-11523. StorageException complaining " no lease ID" when updating FolderLastModifiedTime in WASB. (Duo Xu via cnauroth) + HADOOP-11432. Fix SymlinkBaseTest#testCreateLinkUsingPartQualPath2. + (Liang Xie via gera) + Release 2.6.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java index f8ae27b3125..92d4ecae166 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java @@ -45,12 +45,13 @@ import org.apache.hadoop.fs.permission.AclEntry; import org.apache.hadoop.fs.permission.AclStatus; import org.apache.hadoop.fs.permission.FsAction; import org.apache.hadoop.fs.permission.FsPermission; -import org.apache.hadoop.fs.InvalidPathException; import org.apache.hadoop.security.AccessControlException; import org.apache.hadoop.security.SecurityUtil; import org.apache.hadoop.security.token.Token; import org.apache.hadoop.util.Progressable; +import com.google.common.annotations.VisibleForTesting; + /** * This class provides an interface for implementors of a Hadoop file system * (analogous to the VFS of Unix). Applications do not access this class; @@ -79,6 +80,9 @@ public abstract class AbstractFileSystem { /** The statistics for this file system. */ protected Statistics statistics; + + @VisibleForTesting + static final String NO_ABSTRACT_FS_ERROR = "No AbstractFileSystem configured for scheme"; private final URI myUri; @@ -154,8 +158,8 @@ public abstract class AbstractFileSystem { Class clazz = conf.getClass(fsImplConf, null); if (clazz == null) { throw new UnsupportedFileSystemException(String.format( - "%s=null: No AbstractFileSystem configured for scheme: %s", - fsImplConf, uri.getScheme())); + "%s=null: %s: %s", + fsImplConf, NO_ABSTRACT_FS_ERROR, uri.getScheme())); } return (AbstractFileSystem) newInstance(clazz, uri, conf); } diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/SymlinkBaseTest.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/SymlinkBaseTest.java index 4c10de9e5dd..4d6485d908b 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/SymlinkBaseTest.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/SymlinkBaseTest.java @@ -582,7 +582,7 @@ public abstract class SymlinkBaseTest { // Expected if (wrapper instanceof FileContextTestWrapper) { GenericTestUtils.assertExceptionContains( - "No AbstractFileSystem configured for scheme: null", e); + AbstractFileSystem.NO_ABSTRACT_FS_ERROR, e); } else if (wrapper instanceof FileSystemTestWrapper) { assertEquals("No FileSystem for scheme: null", e.getMessage()); }