Vyom Mani Tiwari created RANGER-5397:
----------------------------------------

             Summary: IllegalArgumentException in RangerRESTClient when no 
ranger.plugin.<service>.policy.rest.url is configured
                 Key: RANGER-5397
                 URL: https://issues.apache.org/jira/browse/RANGER-5397
             Project: Ranger
          Issue Type: Bug
          Components: Ranger
    Affects Versions: 2.7.0, 2.6.0, 2.5.0
            Reporter: Vyom Mani Tiwari
            Assignee: Vyom Mani Tiwari


RangerBasePlugin initialization fails with an IllegalArgumentException when the 
{{ranger.plugin.<serviceType>.policy.rest.url}} property is not set.
 
The issue occurs because {{getConfiguredURLs()}} returns an empty list, causing 
{{Random.nextInt(0)}} to throw an exception.
 
Proposed fix: Handle the case where {{getConfiguredURLs()}} returns an empty 
list, logging a warning and setting a default value.
 
{{int size = getConfiguredURLs().size();if (size == 0) {LOG.warn("No policy 
REST URL configured for service '{}'", 
serviceType);setLastKnownActiveUrlIndex(0);} else 
{setLastKnownActiveUrlIndex(new Random().nextInt(size));}}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to