----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/64677/#review194136 -----------------------------------------------------------
Better to have "!tokens.isEmpty()" than "tokens.size() > 0". Also, the indentation inside the if statement is wrong "if (providerName == null) {". - Colm O hEigeartaigh On Dec. 19, 2017, 1:40 a.m., pengjianhua wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/64677/ > ----------------------------------------------------------- > > (Updated Dec. 19, 2017, 1:40 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/2/ > > > Testing > ------- > > Tested it. > > > Thanks, > > pengjianhua > >