HBASE-8981 add a check on the ServerName parse
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1504572 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
508cb1bd98
commit
f8f0a80d3e
|
@ -128,6 +128,9 @@ public class ServerName implements Comparable<ServerName> {
|
||||||
if (serverName == null || serverName.length() <= 0) {
|
if (serverName == null || serverName.length() <= 0) {
|
||||||
throw new IllegalArgumentException("Passed hostname is null or empty");
|
throw new IllegalArgumentException("Passed hostname is null or empty");
|
||||||
}
|
}
|
||||||
|
if (!Character.isLetterOrDigit(serverName.charAt(0))) {
|
||||||
|
throw new IllegalArgumentException("Bad passed hostname, serverName=" + serverName);
|
||||||
|
}
|
||||||
int index = serverName.indexOf(SERVERNAME_SEPARATOR);
|
int index = serverName.indexOf(SERVERNAME_SEPARATOR);
|
||||||
return serverName.substring(0, index);
|
return serverName.substring(0, index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class TestHCM {
|
||||||
final HConnectionImplementation hci = (HConnectionImplementation)t.getConnection();
|
final HConnectionImplementation hci = (HConnectionImplementation)t.getConnection();
|
||||||
while (t.getRegionLocation(rk).getPort() != sn.getPort()){
|
while (t.getRegionLocation(rk).getPort() != sn.getPort()){
|
||||||
TEST_UTIL.getHBaseAdmin().move(t.getRegionLocation(rk).getRegionInfo().
|
TEST_UTIL.getHBaseAdmin().move(t.getRegionLocation(rk).getRegionInfo().
|
||||||
getEncodedNameAsBytes(), sn.getVersionedBytes());
|
getEncodedNameAsBytes(), Bytes.toBytes(sn.toString()));
|
||||||
while(TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().
|
while(TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().
|
||||||
getRegionStates().isRegionsInTransition()){
|
getRegionStates().isRegionsInTransition()){
|
||||||
Thread.sleep(1);
|
Thread.sleep(1);
|
||||||
|
|
Loading…
Reference in New Issue