|
@@ -3398,12 +3398,26 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- ContentSummary getContentSummary(String src) throws AccessControlException,
|
|
|
- FileNotFoundException, UnresolvedLinkException, StandbyException {
|
|
|
+ /**
|
|
|
+ * Get the content summary for a specific file/dir.
|
|
|
+ *
|
|
|
+ * @param src The string representation of the path to the file
|
|
|
+ *
|
|
|
+ * @throws AccessControlException if access is denied
|
|
|
+ * @throws UnresolvedLinkException if a symlink is encountered.
|
|
|
+ * @throws FileNotFoundException if no file exists
|
|
|
+ * @throws StandbyException
|
|
|
+ * @throws IOException for issues with writing to the audit log
|
|
|
+ *
|
|
|
+ * @return object containing information regarding the file
|
|
|
+ * or null if file not found
|
|
|
+ */
|
|
|
+ ContentSummary getContentSummary(String src) throws IOException {
|
|
|
FSPermissionChecker pc = getPermissionChecker();
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
byte[][] pathComponents = FSDirectory.getPathComponentsForReservedPath(src);
|
|
|
readLock();
|
|
|
+ boolean success = true;
|
|
|
try {
|
|
|
checkOperation(OperationCategory.READ);
|
|
|
src = FSDirectory.resolvePath(src, pathComponents, dir);
|
|
@@ -3411,8 +3425,13 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
checkPermission(pc, src, false, null, null, null, FsAction.READ_EXECUTE);
|
|
|
}
|
|
|
return dir.getContentSummary(src);
|
|
|
+
|
|
|
+ } catch (AccessControlException ace) {
|
|
|
+ success = false;
|
|
|
+ throw ace;
|
|
|
} finally {
|
|
|
readUnlock();
|
|
|
+ logAuditEvent(success, "contentSummary", src);
|
|
|
}
|
|
|
}
|
|
|
|