/** * Checks the permissions for the given path and current user on Hadoop FS. If the given path * does not exists, it returns. */ @SuppressWarnings("deprecation") protected static void checkPermissions(final FileSystem fs, final FileStatus stat, final EnumSet<FsAction> actions, String user) throws IOException, AccessControlException, HiveException { if (stat == null) { // File named by path doesn't exist; nothing to validate. return; } FsAction checkActions = FsAction.NONE; for (FsAction action : actions) { checkActions = checkActions.or(action); } try { FileUtils.checkFileAccessWithImpersonation(fs, stat, checkActions, user); } catch (Exception err) { // fs.permission.AccessControlException removed by HADOOP-11356, but Hive users on older // Hadoop versions may still see this exception .. have to reference by name. if (err.getClass().getName().equals("org.apache.hadoop.fs.permission.AccessControlException")) { throw accessControlException(err); } throw new HiveException(err); } }
/** * Checks the permissions for the given path and current user on Hadoop FS. If the given path * does not exists, it returns. */ @SuppressWarnings("deprecation") protected static void checkPermissions(final FileSystem fs, final FileStatus stat, final EnumSet<FsAction> actions, String user) throws IOException, AccessControlException, HiveException { if (stat == null) { // File named by path doesn't exist; nothing to validate. return; } FsAction checkActions = FsAction.NONE; for (FsAction action : actions) { checkActions = checkActions.or(action); } try { FileUtils.checkFileAccessWithImpersonation(fs, stat, checkActions, user); } catch (Exception err) { // fs.permission.AccessControlException removed by HADOOP-11356, but Hive users on older // Hadoop versions may still see this exception .. have to reference by name. if (err.getClass().getName().equals("org.apache.hadoop.fs.permission.AccessControlException")) { throw accessControlException(err); } throw new HiveException(err); } }
/** * Checks the permissions for the given path and current user on Hadoop FS. If the given path * does not exists, it returns. */ @SuppressWarnings("deprecation") protected static void checkPermissions(final FileSystem fs, final FileStatus stat, final EnumSet<FsAction> actions, String user) throws IOException, AccessControlException, HiveException { if (stat == null) { // File named by path doesn't exist; nothing to validate. return; } FsAction checkActions = FsAction.NONE; for (FsAction action : actions) { checkActions = checkActions.or(action); } try { FileUtils.checkFileAccessWithImpersonation(fs, stat, checkActions, user); } catch (Exception err) { // fs.permission.AccessControlException removed by HADOOP-11356, but Hive users on older // Hadoop versions may still see this exception .. have to reference by name. if (err.getClass().getName().equals("org.apache.hadoop.fs.permission.AccessControlException")) { throw accessControlException(err); } throw new HiveException(err); } }