> On 十二月 18, 2017, 10:05 a.m., Qiang Zhang wrote:
> > agents-audit/src/main/java/org/apache/ranger/audit/provider/BaseAuditHandler.java
> > Lines 95-99 (original), 96-100 (patched)
> > <https://reviews.apache.org/r/64677/diff/1/?file=1919532#file1919532line96>
> >
> >     They should not be included the following code segment.
> >     if (tokens.size() > 1)

Hi,if (providerName == null),the following code not needed to execute if 
(providerName == null) {
                List<String> tokens = MiscUtil.toArray(propPrefix, ".");
                if (tokens.size() > 0) {
                        String finalToken = tokens.get(tokens.size() - 1);
                                setName(finalToken);
                                LOG.info("Using providerName from property 
prefix. providerName="
                                                + getName());
                        }
                }
 Because the follow code had executed before above code segment:        
                "String name = MiscUtil.getStringProperty(props, 
basePropertyName + "."
                                + PROP_NAME);
                if (name != null && !name.isEmpty()) {
                        setName(name);
                }"
  " public void setName(String name) {
                providerName = name;
        }"
 So. add the following code segment."if (tokens.size() > 1)" is better


- pengjianhua


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/64677/#review194054
-----------------------------------------------------------


On 十二月 18, 2017, 7:47 a.m., pengjianhua wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/64677/
> -----------------------------------------------------------
> 
> (Updated 十二月 18, 2017, 7:47 a.m.)
> 
> 
> Review request for ranger, Alok Lal, Ankita Sinha, Don Bosco Durai, Colm O 
> hEigeartaigh, Gautam Borad, Madhan Neethiraj, Ramesh Mani, Selvamohan 
> Neethiraj, Velmurugan Periasamy, and Qiang Zhang.
> 
> 
> Bugs: RANGER-1934
>     https://issues.apache.org/jira/browse/RANGER-1934
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> Optimize the init method in BaseAuditHandler class to avoid 
> ArrayIndexOutOfBoundsException
> The follow in the init method "       List<String> tokens = 
> MiscUtil.toArray(propPrefix, ".");
> String finalToken = tokens.get(tokens.size() - 1);".
> in the init method we should add " if (tokens.size() > 1)" to avoid 
> ArrayIndexOutOfBoundsException.
> 
> 
> Diffs
> -----
> 
>   
> agents-audit/src/main/java/org/apache/ranger/audit/provider/BaseAuditHandler.java
>  b095000 
> 
> 
> Diff: https://reviews.apache.org/r/64677/diff/1/
> 
> 
> Testing
> -------
> 
> Tested it.
> 
> 
> Thanks,
> 
> pengjianhua
> 
>

Reply via email to