You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by da...@apache.org on 2018/08/15 17:22:07 UTC

hive git commit: HIVE-20389: NPE in SessionStateUserAuthenticator when authenticator=SessionStateUserAuthenticator (Daniel Dai, reviewed by Thejas Nair)

Repository: hive
Updated Branches:
  refs/heads/master 691e65448 -> ac247c430


HIVE-20389: NPE in SessionStateUserAuthenticator when authenticator=SessionStateUserAuthenticator (Daniel Dai, reviewed by Thejas Nair)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/ac247c43
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/ac247c43
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/ac247c43

Branch: refs/heads/master
Commit: ac247c4304f45ce7766deacb4826907000447c43
Parents: 691e654
Author: Daniel Dai <da...@gmail.com>
Authored: Wed Aug 15 10:21:46 2018 -0700
Committer: Daniel Dai <da...@gmail.com>
Committed: Wed Aug 15 10:21:46 2018 -0700

----------------------------------------------------------------------
 .../hadoop/hive/ql/security/SessionStateUserAuthenticator.java | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/ac247c43/ql/src/java/org/apache/hadoop/hive/ql/security/SessionStateUserAuthenticator.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/security/SessionStateUserAuthenticator.java b/ql/src/java/org/apache/hadoop/hive/ql/security/SessionStateUserAuthenticator.java
index 1ded295..226fbe0 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/security/SessionStateUserAuthenticator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/security/SessionStateUserAuthenticator.java
@@ -18,7 +18,6 @@
 
 package org.apache.hadoop.hive.ql.security;
 
-import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.hadoop.conf.Configuration;
@@ -32,15 +31,14 @@ import org.apache.hadoop.security.UserGroupInformation;
  */
 public class SessionStateUserAuthenticator implements HiveAuthenticationProvider {
 
-  private final List<String> groupNames = new ArrayList<String>();
-
   protected Configuration conf;
   private SessionState sessionState;
   private List<String> groups;
 
   @Override
   public List<String> getGroupNames() {
-    if (groups == null) {
+       // In case of embedded hs2, sessionState.getUserName()=null
+    if (groups == null && sessionState.getUserName() != null) {
       groups = UserGroupInformation.createRemoteUser(sessionState.getUserName()).getGroups();
     }
     return groups;