Repository: hadoop
Updated Branches:
  refs/heads/branch-2 0b8767e01 -> a1f913fb6


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/a1f913fb
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a1f913fb
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a1f913fb

Branch: refs/heads/branch-2
Commit: a1f913fb6e917f90d9492c78a30b380096ddb3db
Parents: 0b8767e
Author: Yongjun Zhang <yzh...@cloudera.com>
Authored: Wed Jan 27 08:04:25 2016 -0800
Committer: Yongjun Zhang <yzh...@cloudera.com>
Committed: Wed Jan 27 08:05:17 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/a1f913fb/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 1532af3..7040048 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -1015,6 +1015,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/a1f913fb/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];

Reply via email to