You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ni...@apache.org on 2019/05/29 10:04:14 UTC
[ranger] branch master updated: RANGER-2449 : If service part of
zone is not present then null pointer exception is thrown
This is an automated email from the ASF dual-hosted git repository.
nikhil pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git
The following commit(s) were added to refs/heads/master by this push:
new abfdb08 RANGER-2449 : If service part of zone is not present then null pointer exception is thrown
abfdb08 is described below
commit abfdb0893f3cd50ced6941d059c08fb82380f598
Author: Nikhil P <ni...@apache.org>
AuthorDate: Wed May 29 15:32:59 2019 +0530
RANGER-2449 : If service part of zone is not present then null pointer exception is thrown
---
.../java/org/apache/ranger/rest/SecurityZoneREST.java | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/security-admin/src/main/java/org/apache/ranger/rest/SecurityZoneREST.java b/security-admin/src/main/java/org/apache/ranger/rest/SecurityZoneREST.java
index ce3ffc8..fcf8433 100644
--- a/security-admin/src/main/java/org/apache/ranger/rest/SecurityZoneREST.java
+++ b/security-admin/src/main/java/org/apache/ranger/rest/SecurityZoneREST.java
@@ -466,13 +466,17 @@ public class SecurityZoneREST {
private void blockAdminFromKMSService(RangerSecurityZone securityZone) {
if(securityZone != null) {
Map<String, RangerSecurityZoneService> serviceMap = securityZone.getServices();
- for (String serviceName : serviceMap.keySet()) {
- XXService xService = daoManager.getXXService().findByName(serviceName);
- XXServiceDef xServiceDef = daoManager.getXXServiceDef().getById(xService.getType());
- if (EmbeddedServiceDefsUtil.KMS_IMPL_CLASS_NAME.equals(xServiceDef.getImplclassname())) {
- throw restErrorUtil.createRESTException(
- "KMS Services/Service-Defs are not accessible for Zone operations",
- MessageEnums.OPER_NOT_ALLOWED_FOR_ENTITY);
+ if (serviceMap != null) {
+ for (String serviceName : serviceMap.keySet()) {
+ XXService xService = daoManager.getXXService().findByName(serviceName);
+ if (xService != null) {
+ XXServiceDef xServiceDef = daoManager.getXXServiceDef().getById(xService.getType());
+ if (EmbeddedServiceDefsUtil.KMS_IMPL_CLASS_NAME.equals(xServiceDef.getImplclassname())) {
+ throw restErrorUtil.createRESTException(
+ "KMS Services/Service-Defs are not accessible for Zone operations",
+ MessageEnums.OPER_NOT_ALLOWED_FOR_ENTITY);
+ }
+ }
}
}
}