Index: src/main/java/org/apache/hadoop/hbase/util/FSUtils.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/util/FSUtils.java (revision 1445268) +++ src/main/java/org/apache/hadoop/hbase/util/FSUtils.java (working copy) @@ -1200,7 +1200,15 @@ */ public static void checkAccess(UserGroupInformation ugi, FileStatus file, FsAction action) throws AccessControlException { - if (ugi.getUserName().equals(file.getOwner())) { + // See HBASE-7814. UserGroupInformation from hadoop 0.20.x may not support getShortUserName(). + String username; + try { + Method m = UserGroupInformation.class.getMethod("getShortUserName", new Class[]{}); + username = (String) m.invoke(ugi); + } catch (Exception e) { + username = ugi.getUserName(); + } + if (username.equals(file.getOwner())) { if (file.getPermission().getUserAction().implies(action)) { return; } @@ -1212,7 +1220,7 @@ return; } throw new AccessControlException("Permission denied:" + " action=" + action - + " path=" + file.getPath() + " user=" + ugi.getUserName()); + + " path=" + file.getPath() + " user=" + username); } private static boolean contains(String[] groups, String user) {