HDFS-15145. HttpFS: getAclStatus() returns permission as null. Contributed by hemanthboyina.
This commit is contained in:
parent
1ab9c692fa
commit
061421fc6d
@ -1135,6 +1135,8 @@ private AclStatus createAclStatus(JSONObject json) {
|
|||||||
.owner((String) json.get(OWNER_JSON))
|
.owner((String) json.get(OWNER_JSON))
|
||||||
.group((String) json.get(GROUP_JSON))
|
.group((String) json.get(GROUP_JSON))
|
||||||
.stickyBit((Boolean) json.get(ACL_STICKY_BIT_JSON));
|
.stickyBit((Boolean) json.get(ACL_STICKY_BIT_JSON));
|
||||||
|
final FsPermission permission = toFsPermission(json);
|
||||||
|
aclStatusBuilder.setPermission(permission);
|
||||||
JSONArray entries = (JSONArray) json.get(ACL_ENTRIES_JSON);
|
JSONArray entries = (JSONArray) json.get(ACL_ENTRIES_JSON);
|
||||||
for ( Object e : entries ) {
|
for ( Object e : entries ) {
|
||||||
aclStatusBuilder.addEntry(AclEntry.parseAclEntry(e.toString(), true));
|
aclStatusBuilder.addEntry(AclEntry.parseAclEntry(e.toString(), true));
|
||||||
|
@ -189,6 +189,8 @@ private static Map<String,Object> aclStatusToJSON(AclStatus aclStatus) {
|
|||||||
JSONArray entriesArray = new JSONArray();
|
JSONArray entriesArray = new JSONArray();
|
||||||
inner.put(HttpFSFileSystem.OWNER_JSON, aclStatus.getOwner());
|
inner.put(HttpFSFileSystem.OWNER_JSON, aclStatus.getOwner());
|
||||||
inner.put(HttpFSFileSystem.GROUP_JSON, aclStatus.getGroup());
|
inner.put(HttpFSFileSystem.GROUP_JSON, aclStatus.getGroup());
|
||||||
|
inner.put(HttpFSFileSystem.PERMISSION_JSON,
|
||||||
|
HttpFSFileSystem.permissionToString(aclStatus.getPermission()));
|
||||||
inner.put(HttpFSFileSystem.ACL_STICKY_BIT_JSON, aclStatus.isStickyBit());
|
inner.put(HttpFSFileSystem.ACL_STICKY_BIT_JSON, aclStatus.isStickyBit());
|
||||||
for ( AclEntry e : aclStatus.getEntries() ) {
|
for ( AclEntry e : aclStatus.getEntries() ) {
|
||||||
entriesArray.add(e.toString());
|
entriesArray.add(e.toString());
|
||||||
|
@ -946,10 +946,11 @@ private void testListXAttrs() throws Exception {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private void assertSameAcls(AclStatus a, AclStatus b) throws Exception {
|
private void assertSameAcls(AclStatus a, AclStatus b) throws Exception {
|
||||||
assertTrue(a.getOwner().equals(b.getOwner()));
|
assertEquals(a.getOwner(), b.getOwner());
|
||||||
assertTrue(a.getGroup().equals(b.getGroup()));
|
assertEquals(a.getGroup(), b.getGroup());
|
||||||
assertTrue(a.isStickyBit() == b.isStickyBit());
|
assertEquals(a.getPermission(), b.getPermission());
|
||||||
assertTrue(a.getEntries().size() == b.getEntries().size());
|
assertEquals(a.isStickyBit(), b.isStickyBit());
|
||||||
|
assertEquals(a.getEntries().size(), b.getEntries().size());
|
||||||
for (AclEntry e : a.getEntries()) {
|
for (AclEntry e : a.getEntries()) {
|
||||||
assertTrue(b.getEntries().contains(e));
|
assertTrue(b.getEntries().contains(e));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user