ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [07/15] incubator-ranger git commit: NPE fix
Date Mon, 01 Jun 2015 23:20:13 GMT
NPE fix

Signed-off-by: sneethiraj <sneethir@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/29f8f202
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/29f8f202
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/29f8f202

Branch: refs/heads/tag-policy
Commit: 29f8f2027f7703dcb144f4bd87499fe3d8459a88
Parents: ab4683e
Author: Gautam Borad <gborad@gmail.com>
Authored: Tue May 19 18:42:52 2015 +0530
Committer: sneethiraj <sneethir@apache.org>
Committed: Sat May 30 23:48:27 2015 -0400

----------------------------------------------------------------------
 .../org/apache/ranger/service/RangerServiceDefService.java     | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/29f8f202/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefService.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefService.java
b/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefService.java
index ecf0b16..33a2da3 100644
--- a/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefService.java
+++ b/security-admin/src/main/java/org/apache/ranger/service/RangerServiceDefService.java
@@ -26,6 +26,7 @@ import org.apache.ranger.common.SearchField;
 import org.apache.ranger.common.SortField;
 import org.apache.ranger.common.SearchField.DATA_TYPE;
 import org.apache.ranger.common.SearchField.SEARCH_TYPE;
+import org.apache.ranger.common.UserSessionBase;
 import org.apache.ranger.entity.XXContextEnricherDef;
 import org.apache.ranger.entity.XXAccessTypeDef;
 import org.apache.ranger.entity.XXEnumDef;
@@ -158,13 +159,14 @@ public class RangerServiceDefService extends RangerServiceDefServiceBase<XXServi
 		return this.populateViewBean(xServiceDef);
 	}
 	@Override
-	@SuppressWarnings("unchecked")
 	public RangerServiceDefList searchRangerServiceDefs(SearchFilter searchFilter) {
 		List<RangerServiceDef> serviceDefList = new ArrayList<RangerServiceDef>();
 		RangerServiceDefList retList = new RangerServiceDefList();
 
 		List<XXServiceDef> xSvcDefList = (List<XXServiceDef>) searchResources(searchFilter,
searchFields, sortFields, retList);
-		List<String> userRoleList = ContextUtil.getCurrentUserSession().getUserRoleList();
+		UserSessionBase sessionBase = ContextUtil.getCurrentUserSession();
+		List<String> userRoleList = (sessionBase != null) ? sessionBase.getUserRoleList()
: null;
+
 		for (XXServiceDef xSvcDef : xSvcDefList) {
 			if(userRoleList != null && !userRoleList.contains(RangerConstants.ROLE_KEY_ADMIN)){
 				if(xSvcDef!=null && !"KMS".equalsIgnoreCase(xSvcDef.getName())){


Mime
View raw message