From b3269f7cc119cbc51b16118b918f345f970804bc Mon Sep 17 00:00:00 2001 From: Kihwal Lee Date: Thu, 20 Jul 2017 16:12:21 -0500 Subject: [PATCH] HADOOP-14659. UGI getShortUserName does not need to search the Subject. Contributed by Daryn Sharp. --- .../org/apache/hadoop/security/UserGroupInformation.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java index 0510abd043..e4d01a1a23 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/UserGroupInformation.java @@ -1678,10 +1678,7 @@ public static UserGroupInformation createProxyUserForTesting(String user, * @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 {