HADOOP-10507. Merging change r1609503 from trunk to branch-2.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1609506 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2014-07-10 17:03:08 +00:00
parent 52a07f1a39
commit 41406e3702
3 changed files with 17 additions and 1 deletions

View File

@ -15,6 +15,9 @@ Release 2.6.0 - UNRELEASED
HADOOP-10781. Unportable getgrouplist() usage breaks FreeBSD (Dmitry
Sivachenko via Colin Patrick McCabe)
HADOOP-10507. FsShell setfacl can throw ArrayIndexOutOfBoundsException when
no perm is specified. (Stephen Chu and Sathish Gurram via cnauroth)
Release 2.5.0 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -278,7 +278,7 @@ public class AclEntry {
}
if (includePermission) {
if (split.length < index) {
if (split.length <= index) {
throw new HadoopIllegalArgumentException("Invalid <aclSpec> : "
+ aclStr);
}

View File

@ -83,6 +83,19 @@ public class TestAclCommands {
"", "/path" }));
}
@Test
public void testSetfaclValidationsWithoutPermissions() throws Exception {
List<AclEntry> parsedList = new ArrayList<AclEntry>();
try {
parsedList = AclEntry.parseAclSpec("user:user1:", true);
} catch (IllegalArgumentException e) {
}
assertTrue(parsedList.size() == 0);
assertFalse("setfacl should fail with less arguments",
0 == runCommand(new String[] { "-setfacl", "-m", "user:user1:",
"/path" }));
}
@Test
public void testMultipleAclSpecParsing() throws Exception {
List<AclEntry> parsedList = AclEntry.parseAclSpec(