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

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


The following commit(s) were added to refs/heads/ranger-2.7 by this push:
     new 1ca50f9fb RANGER-5247: updated Ozone authorizer to replace unused 
instance member with a local variable (#606)
1ca50f9fb is described below

commit 1ca50f9fb53813f43343091e03113e15ccbf8b2c
Author: Madhan Neethiraj <mad...@apache.org>
AuthorDate: Sun Jul 13 15:39:13 2025 -0700

    RANGER-5247: updated Ozone authorizer to replace unused instance member 
with a local variable (#606)
    
    (cherry picked from commit 522e4451348091864c87d9ae7358902ac29f3f68)
---
 .../authorization/ozone/authorizer/RangerOzoneAuthorizer.java | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/plugin-ozone/src/main/java/org/apache/ranger/authorization/ozone/authorizer/RangerOzoneAuthorizer.java
 
b/plugin-ozone/src/main/java/org/apache/ranger/authorization/ozone/authorizer/RangerOzoneAuthorizer.java
index 3bd17d52f..3b80da65b 100644
--- 
a/plugin-ozone/src/main/java/org/apache/ranger/authorization/ozone/authorizer/RangerOzoneAuthorizer.java
+++ 
b/plugin-ozone/src/main/java/org/apache/ranger/authorization/ozone/authorizer/RangerOzoneAuthorizer.java
@@ -57,7 +57,6 @@ public class RangerOzoneAuthorizer implements 
IAccessAuthorizer {
     private static final Logger LOG = 
LoggerFactory.getLogger(RangerOzoneAuthorizer.class);
 
        private static volatile RangerBasePlugin rangerPlugin = null;
-       RangerDefaultAuditHandler auditHandler = null;
 
        public RangerOzoneAuthorizer() {
                RangerBasePlugin plugin = rangerPlugin;
@@ -70,7 +69,7 @@ public RangerOzoneAuthorizer() {
                                        plugin = new RangerBasePlugin("ozone", 
"ozone");
                                        plugin.init(); // this will initialize 
policy engine and policy refresher
 
-                                       auditHandler = new 
RangerDefaultAuditHandler();
+                                       RangerDefaultAuditHandler auditHandler 
= new RangerDefaultAuditHandler();
                                        plugin.setResultProcessor(auditHandler);
 
                                        rangerPlugin = plugin;
@@ -97,7 +96,9 @@ public boolean checkAccess(IOzoneObj ozoneObject, 
RequestContext context) {
                                        context.getIp() + ", resourceType = " + 
ozoneObj.getResourceType() + ")");
                }
 
-               if (rangerPlugin == null) {
+               RangerBasePlugin plugin = rangerPlugin;
+
+               if (plugin == null) {
                        MiscUtil.logErrorMessageByInterval(LOG,
                                        "Authorizer is still not initialized");
                        return returnValue;
@@ -127,7 +128,7 @@ public boolean checkAccess(IOzoneObj ozoneObject, 
RequestContext context) {
                        return returnValue;
                }
                String action = accessType;
-               String clusterName = rangerPlugin.getClusterName();
+               String clusterName = plugin.getClusterName();
 
                RangerAccessRequestImpl rangerRequest = new 
RangerAccessRequestImpl();
                rangerRequest.setUser(ugi.getShortUserName());
@@ -165,7 +166,7 @@ public boolean checkAccess(IOzoneObj ozoneObject, 
RequestContext context) {
                }
 
                try {
-                       RangerAccessResult result = rangerPlugin
+                       RangerAccessResult result = plugin
                                        .isAccessAllowed(rangerRequest);
                        if (result == null) {
                                LOG.error("Ranger Plugin returned null. 
Returning false");

Reply via email to