HADOOP-10354. TestWebHDFS fails after merge of HDFS-4685 to trunk. Contributed by Chris Nauroth.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1570655 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2014-02-21 18:42:06 +00:00
parent 19f870858e
commit 58fb83d982
3 changed files with 14 additions and 3 deletions

View File

@ -329,6 +329,8 @@ Trunk (Unreleased)
HADOOP-10352. Recursive setfacl erroneously attempts to apply default ACL to HADOOP-10352. Recursive setfacl erroneously attempts to apply default ACL to
files. (cnauroth) files. (cnauroth)
HADOOP-10354. TestWebHDFS fails after merge of HDFS-4685 to trunk. (cnauroth)
OPTIMIZATIONS OPTIMIZATIONS
HADOOP-7761. Improve the performance of raw comparisons. (todd) HADOOP-7761. Improve the performance of raw comparisons. (todd)

View File

@ -569,6 +569,11 @@ public class RawLocalFileSystem extends FileSystem {
//expected format //expected format
//-rw------- 1 username groupname ... //-rw------- 1 username groupname ...
String permission = t.nextToken(); String permission = t.nextToken();
if (permission.length() > FsPermission.MAX_PERMISSION_LENGTH) {
//files with ACLs might have a '+'
permission = permission.substring(0,
FsPermission.MAX_PERMISSION_LENGTH);
}
setPermission(FsPermission.valueOf(permission)); setPermission(FsPermission.valueOf(permission));
t.nextToken(); t.nextToken();

View File

@ -48,6 +48,9 @@ public class FsPermission implements Writable {
WritableFactories.setFactory(ImmutableFsPermission.class, FACTORY); WritableFactories.setFactory(ImmutableFsPermission.class, FACTORY);
} }
/** Maximum acceptable length of a permission string to parse */
public static final int MAX_PERMISSION_LENGTH = 10;
/** Create an immutable {@link FsPermission} object. */ /** Create an immutable {@link FsPermission} object. */
public static FsPermission createImmutable(short permission) { public static FsPermission createImmutable(short permission) {
return new ImmutableFsPermission(permission); return new ImmutableFsPermission(permission);
@ -319,9 +322,10 @@ public class FsPermission implements Writable {
if (unixSymbolicPermission == null) { if (unixSymbolicPermission == null) {
return null; return null;
} }
else if (unixSymbolicPermission.length() != 10) { else if (unixSymbolicPermission.length() != MAX_PERMISSION_LENGTH) {
throw new IllegalArgumentException("length != 10(unixSymbolicPermission=" throw new IllegalArgumentException(String.format(
+ unixSymbolicPermission + ")"); "length != %d(unixSymbolicPermission=%s)", MAX_PERMISSION_LENGTH,
unixSymbolicPermission));
} }
int n = 0; int n = 0;