You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ma...@apache.org on 2020/08/30 17:28:58 UTC

[ranger] 01/03: RANGER-2979: fix for NPE in unit-test

This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git

commit bda27055c1d7b2df1a2e70a7a9c035759420803b
Author: Madhan Neethiraj <ma...@apache.org>
AuthorDate: Sat Aug 29 11:59:51 2020 -0700

    RANGER-2979: fix for NPE in unit-test
---
 .../authorization/hive/authorizer/RangerHiveAuthorizer.java       | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java
index e54f93a..d2b7807 100644
--- a/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java
+++ b/hive-agent/src/main/java/org/apache/ranger/authorization/hive/authorizer/RangerHiveAuthorizer.java
@@ -347,7 +347,13 @@ public class RangerHiveAuthorizer extends RangerHiveAuthorizerBase {
 			if (LOG.isDebugEnabled()) {
 				LOG.debug("<== getCurrentRoleNamesFromRanger() for user " + user);
 			}
-			Set<String> userRoles = new HashSet<String>(hivePlugin.getUserRoles(user, auditHandler));
+
+			List<String> userRoles = hivePlugin.getUserRoles(user, auditHandler);
+
+			if (userRoles == null) {
+				userRoles = Collections.emptyList();
+			}
+
 			for (String role : userRoles) {
 				if (!ROLE_ADMIN.equalsIgnoreCase(role)) {
 					ret.add(role);