From 584e384fd68281136fec8310017c1838569cbf73 Mon Sep 17 00:00:00 2001 From: Kihwal Lee Date: Thu, 8 May 2014 18:22:42 +0000 Subject: [PATCH] Correcting the check-in mistake for HADOOP-10581. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1593360 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/hadoop/security/UserGroupInformation.java | 4 +++- .../apache/hadoop/security/TestUserGroupInformation.java | 6 ++++-- 2 files changed, 7 insertions(+), 3 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 cee4e11750..b1d164d58f 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 @@ -37,6 +37,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -1464,7 +1465,8 @@ private synchronized Credentials getCredentialsInternal() { public synchronized String[] getGroupNames() { ensureInitialized(); try { - List result = groups.getGroups(getShortUserName()); + Set result = new LinkedHashSet + (groups.getGroups(getShortUserName())); return result.toArray(new String[result.size()]); } catch (IOException ie) { LOG.warn("No groups available for user " + getShortUserName()); diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestUserGroupInformation.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestUserGroupInformation.java index c347603e6d..614054f7c2 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestUserGroupInformation.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/TestUserGroupInformation.java @@ -17,6 +17,7 @@ package org.apache.hadoop.security; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.CommonConfigurationKeysPublic; import org.apache.hadoop.io.Text; import org.apache.hadoop.metrics2.MetricsRecordBuilder; import org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod; @@ -35,8 +36,9 @@ import java.io.InputStreamReader; import java.lang.reflect.Method; import java.security.PrivilegedExceptionAction; -import java.util.ArrayList; import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.Set; import static org.apache.hadoop.fs.CommonConfigurationKeys.HADOOP_USER_GROUP_METRICS_PERCENTILES_INTERVALS; import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTH_TO_LOCAL; @@ -206,7 +208,7 @@ public void testGetServerSideGroups() throws IOException, System.out.println(userName + ":" + line); - ArrayList groups = new ArrayList (); + Set groups = new LinkedHashSet (); String[] tokens = line.split(Shell.TOKEN_SEPARATOR_REGEX); for(String s: tokens) { groups.add(s);