This is an automated email from the ASF dual-hosted git repository.
ayushsaxena pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 80cccc5 HDFS-16351. Add path exception information in FSNamesystem
(#3713). Contributed by guophilipse.
80cccc5 is described below
commit 80cccc5376cb56169451548fee39a0f707825766
Author: GuoPhilipse <[email protected]>
AuthorDate: Tue Dec 7 16:49:27 2021 +0800
HDFS-16351. Add path exception information in FSNamesystem (#3713).
Contributed by guophilipse.
Reviewed-by: Viraj Jasani <[email protected]>
Signed-off-by: Ayush Saxena <[email protected]>
---
.../org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 2 +-
.../test/java/org/apache/hadoop/hdfs/TestDFSPermission.java | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
index d856d6f..c07115e 100644
---
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
+++
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
@@ -8612,7 +8612,7 @@ public class FSNamesystem implements Namesystem,
FSNamesystemMBean,
src = iip.getPath();
INode inode = iip.getLastINode();
if (inode == null) {
- throw new FileNotFoundException("Path not found");
+ throw new FileNotFoundException("Path not found: " + src);
}
if (isPermissionEnabled) {
dir.checkPathAccess(pc, iip, mode);
diff --git
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSPermission.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSPermission.java
index 15ce06b..818f756 100644
---
a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSPermission.java
+++
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSPermission.java
@@ -44,6 +44,7 @@ import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.fs.permission.FsAction;
import org.apache.hadoop.security.AccessControlException;
import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.test.LambdaTestUtils;
import org.apache.hadoop.util.Time;
import org.junit.After;
import org.junit.Before;
@@ -260,6 +261,17 @@ public class TestDFSPermission {
checkPermission(name, expectedPermission, delete);
}
+ @Test
+ public void testFSNamesystemCheckAccess() throws Exception{
+ Path testInvalidPath = new Path("/test2");
+ fs = FileSystem.get(conf);
+
+ LambdaTestUtils.intercept(
+ FileNotFoundException.class,
+ "Path not found: " + testInvalidPath,
+ () -> fs.access(testInvalidPath, FsAction.READ));
+ }
+
/* Check if the permission of a file/directory is the same as the
* expected permission; If the delete flag is true, delete the
* file/directory afterwards.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]