Details
Description
When run IntegrationTestIngestWithACL on distributed clusters with kerberos security enabled, the method addAuthInfoToConf() in LoadTestTool will be invoked and throws UnsupportedOperationException, stack as follows:
2015-06-09 22:15:33,605 ERROR [main] util.AbstractHBaseTool: Error running command-line tool java.lang.UnsupportedOperationException at java.util.AbstractList.add(AbstractList.java:148) at java.util.AbstractList.add(AbstractList.java:108) at org.apache.hadoop.hbase.util.LoadTestTool.addAuthInfoToConf(LoadTestTool.java:811) at org.apache.hadoop.hbase.util.LoadTestTool.loadTable(LoadTestTool.java:516) at org.apache.hadoop.hbase.util.LoadTestTool.doWork(LoadTestTool.java:479) at org.apache.hadoop.hbase.util.AbstractHBaseTool.run(AbstractHBaseTool.java:112) at org.apache.hadoop.hbase.IntegrationTestIngest.runIngestTest(IntegrationTestIngest.java:151) at org.apache.hadoop.hbase.IntegrationTestIngest.internalRunIngestTest(IntegrationTestIngest.java:114) at org.apache.hadoop.hbase.IntegrationTestIngest.runTestFromCommandLine(IntegrationTestIngest.java:97) at org.apache.hadoop.hbase.IntegrationTestBase.doWork(IntegrationTestBase.java:115) at org.apache.hadoop.hbase.util.AbstractHBaseTool.run(AbstractHBaseTool.java:112) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.hadoop.hbase.IntegrationTestIngestWithACL.main(IntegrationTestIngestWithACL.java:136)
The corresponding code is below and the reason is obvious. Arrays.asList return a java.util.Arrays$ArrayList but not java.util.ArrayList. Both of them are inherited from java.util.AbstractList, but the former didn't override the method add(), so the parent method java.util.AbstractList.add() will be invoked and the exception threw.
private void addAuthInfoToConf(Properties authConfig, Configuration conf, String owner, String userList) throws IOException { List<String> users = Arrays.asList(userList.split(",")); users.add(owner); ... }
Does anyone occurred on this? I think it's an obvious bug but no one report it, so please tell me if I misunderstanding it. If it's actually a bug here, then it can be fixed very easy as below:
List<String> users = new ArrayList<String>(Arrays.asList(userList.split(",")));