소스 검색

HADOOP-14659. UGI getShortUserName does not need to search the Subject. Contributed by Daryn Sharp.

(cherry picked from commit b3269f7cc119cbc51b16118b918f345f970804bc)
Kihwal Lee 7 년 전
부모
커밋
5d58ba0e3d
1개의 변경된 파일1개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 4
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java

+ 1 - 4
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java

@@ -1552,10 +1552,7 @@ public class UserGroupInformation {
    * @return the user's name up to the first '/' or '@'.
    */
   public String getShortUserName() {
-    for (User p: subject.getPrincipals(User.class)) {
-      return p.getShortName();
-    }
-    return null;
+    return user.getShortName();
   }
 
   public String getPrimaryGroupName() throws IOException {