HADOOP-12718. Incorrect error message by fs -put local dir without permission. (John Zhuge via Yongjun Zhang)
(cherry picked from commit 97056c3355810a803f07baca89b89e2bf6bb7201)
This commit is contained in:
parent
0b8767e01a
commit
a1f913fb6e
@ -1015,6 +1015,9 @@ Release 2.8.0 - UNRELEASED
|
|||||||
HADOOP-12731. Remove useless boxing/unboxing code.
|
HADOOP-12731. Remove useless boxing/unboxing code.
|
||||||
(Kousuke Saruta via aajisaka)
|
(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
|
Release 2.7.3 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.file.AccessDeniedException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.NoSuchFileException;
|
import java.nio.file.NoSuchFileException;
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
@ -450,6 +451,10 @@ public FileStatus[] listStatus(Path f) throws IOException {
|
|||||||
if (localf.isDirectory()) {
|
if (localf.isDirectory()) {
|
||||||
String[] names = localf.list();
|
String[] names = localf.list();
|
||||||
if (names == null) {
|
if (names == null) {
|
||||||
|
if (!localf.canRead()) {
|
||||||
|
throw new AccessDeniedException("cannot open directory " + f +
|
||||||
|
": Permission denied");
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
results = new FileStatus[names.length];
|
results = new FileStatus[names.length];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user