HBASE-21303 [shell] clear_deadservers with no args fails

This commit is contained in:
Michael Stack 2018-10-12 10:34:59 -07:00
parent 9d6afa9d72
commit 6125872f48
1 changed files with 4 additions and 5 deletions

View File

@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.InterruptedIOException; import java.io.InterruptedIOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
@ -4287,15 +4288,13 @@ public class HBaseAdmin implements Admin {
} }
@Override @Override
public List<ServerName> clearDeadServers(final List<ServerName> servers) throws IOException { public List<ServerName> clearDeadServers(List<ServerName> servers) throws IOException {
if (servers == null || servers.size() == 0) {
throw new IllegalArgumentException("servers cannot be null or empty");
}
return executeCallable(new MasterCallable<List<ServerName>>(getConnection(), return executeCallable(new MasterCallable<List<ServerName>>(getConnection(),
getRpcControllerFactory()) { getRpcControllerFactory()) {
@Override @Override
protected List<ServerName> rpcCall() throws Exception { protected List<ServerName> rpcCall() throws Exception {
ClearDeadServersRequest req = RequestConverter.buildClearDeadServersRequest(servers); ClearDeadServersRequest req = RequestConverter.
buildClearDeadServersRequest(servers == null? Collections.EMPTY_LIST: servers);
return ProtobufUtil.toServerNameList( return ProtobufUtil.toServerNameList(
master.clearDeadServers(getRpcController(), req).getServerNameList()); master.clearDeadServers(getRpcController(), req).getServerNameList());
} }