ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From me...@apache.org
Subject [3/4] ranger git commit: RANGER-2186: Part II - check for NPE when incrementing service-specific policy and tag versions after update transaction is committed
Date Wed, 19 Sep 2018 05:40:55 GMT
RANGER-2186: Part II - check for NPE when incrementing service-specific policy and tag versions
after update transaction is committed


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

Branch: refs/heads/ranger-1.1
Commit: a7dabb3ff7d8b879808ec6966d6a4f2d7d6f2737
Parents: 5c1c35c
Author: Abhay Kulkarni <akulkarni@hortonworks.com>
Authored: Mon Sep 17 11:42:02 2018 -0700
Committer: Mehul Parikh <mehul@apache.org>
Committed: Wed Sep 19 11:09:08 2018 +0530

----------------------------------------------------------------------
 .../org/apache/ranger/biz/ServiceDBStore.java     | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/a7dabb3f/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java b/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java
index 32af4cd..6c699ca 100644
--- a/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java
@@ -2880,14 +2880,16 @@ public class ServiceDBStore extends AbstractServiceStore {
 
 		} else {
 			XXService service = daoMgr.getXXService().getById(id);
-			serviceVersionInfoDbObj = new XXServiceVersionInfo();
-			serviceVersionInfoDbObj.setServiceId(service.getId());
-			serviceVersionInfoDbObj.setPolicyVersion(1L);
-			serviceVersionInfoDbObj.setPolicyUpdateTime(new Date());
-			serviceVersionInfoDbObj.setTagVersion(1L);
-			serviceVersionInfoDbObj.setTagUpdateTime(new Date());
-
-			serviceVersionInfoDao.create(serviceVersionInfoDbObj);
+			if (service != null) {
+				serviceVersionInfoDbObj = new XXServiceVersionInfo();
+				serviceVersionInfoDbObj.setServiceId(service.getId());
+				serviceVersionInfoDbObj.setPolicyVersion(1L);
+				serviceVersionInfoDbObj.setPolicyUpdateTime(new Date());
+				serviceVersionInfoDbObj.setTagVersion(1L);
+				serviceVersionInfoDbObj.setTagUpdateTime(new Date());
+
+				serviceVersionInfoDao.create(serviceVersionInfoDbObj);
+			}
 		}
 	}
 


Mime
View raw message