pradeepagrawal8184 commented on code in PR #950:
URL: https://github.com/apache/ranger/pull/950#discussion_r3306083894
##########
agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceDefHelper.java:
##########
@@ -548,6 +557,15 @@ public Delegate(RangerServiceDef serviceDef, boolean
checkForCycles) {
LOG.debug("Found [{}] resource hierarchies for service [{}]
update-date[{}]: {}", hierarchies.size(), serviceName, serviceDefFreshnessDate,
hierarchies);
}
+ private RangerResourceDef
createWildcardEnabledResourceDef(RangerResourceDef resourceDef) {
+ if (resourceDef == null) {
+ return null;
Review Comment:
The constructor loop already guards with if (res != null) before calling
createWildcardEnabledResourceDef. The null check here is harmless but
redundant;
##########
agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceDefHelper.java:
##########
@@ -686,31 +704,11 @@ RangerResourceDef getWildcardEnabledResourceDef(String
resourceName, Integer pol
if (policyType == null) {
Review Comment:
Should this condition be similar to line 621 ?
##########
agents-common/src/main/java/org/apache/ranger/plugin/model/validation/RangerServiceDefHelper.java:
##########
@@ -507,14 +507,23 @@ public Delegate(RangerServiceDef serviceDef, boolean
checkForCycles) {
this.hierarchies.put(policyType,
Collections.unmodifiableSet(hierarchies));
hierarchyKeys.put(policyType,
Collections.unmodifiableSet(hierachyKeys));
+ Map<String, RangerResourceDef> wildcardMap = new
HashMap<>(resources.size());
+ for (RangerResourceDef res : resources) {
+ if (res != null) {
+ wildcardMap.put(res.getName(),
createWildcardEnabledResourceDef(res));
Review Comment:
is there possibility of duplicate resource in resources object:
If resources contains duplicate names, later entries considered in
wildcardMap.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]