Repository: hadoop Updated Branches: refs/heads/branch-2.8 b6fe3c20c -> 62206dd2e
HADOOP-12718. Incorrect error message by fs -put local dir without permission. (John Zhuge via Yongjun Zhang) (cherry picked from commit 97056c3355810a803f07baca89b89e2bf6bb7201) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/62206dd2 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/62206dd2 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/62206dd2 Branch: refs/heads/branch-2.8 Commit: 62206dd2edcc53dbfbae30a524c21e7eb828bd0e Parents: b6fe3c2 Author: Yongjun Zhang <[email protected]> Authored: Wed Jan 27 08:04:25 2016 -0800 Committer: Yongjun Zhang <[email protected]> Committed: Wed Jan 27 08:05:33 2016 -0800 ---------------------------------------------------------------------- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java | 5 +++++ 2 files changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/62206dd2/hadoop-common-project/hadoop-common/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 8dc42a2..040f143 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -961,6 +961,9 @@ Release 2.8.0 - UNRELEASED HADOOP-12731. Remove useless boxing/unboxing code. (Kousuke Saruta via aajisaka) + HADOOP-12718. Incorrect error message by fs -put local dir without + permission. (John Zhuge via Yongjun Zhang) + Release 2.7.3 - UNRELEASED INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/hadoop/blob/62206dd2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java index a6a9665..318bbb0 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java @@ -33,6 +33,7 @@ import java.io.OutputStream; import java.io.FileDescriptor; import java.net.URI; import java.nio.ByteBuffer; +import java.nio.file.AccessDeniedException; import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.attribute.BasicFileAttributes; @@ -450,6 +451,10 @@ public class RawLocalFileSystem extends FileSystem { if (localf.isDirectory()) { String[] names = localf.list(); if (names == null) { + if (!localf.canRead()) { + throw new AccessDeniedException("cannot open directory " + f + + ": Permission denied"); + } return null; } results = new FileStatus[names.length];
