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:
nkeywal 2013-07-18 18:03:53 +00:00
parent 508cb1bd98
commit f8f0a80d3e
2 changed files with 4 additions and 1 deletions

View File

@ -128,6 +128,9 @@ public class ServerName implements Comparable<ServerName> {
if (serverName == null || serverName.length() <= 0) {
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);
return serverName.substring(0, index);
}

View File

@ -130,7 +130,7 @@ public class TestHCM {
final HConnectionImplementation hci = (HConnectionImplementation)t.getConnection();
while (t.getRegionLocation(rk).getPort() != sn.getPort()){
TEST_UTIL.getHBaseAdmin().move(t.getRegionLocation(rk).getRegionInfo().
getEncodedNameAsBytes(), sn.getVersionedBytes());
getEncodedNameAsBytes(), Bytes.toBytes(sn.toString()));
while(TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().
getRegionStates().isRegionsInTransition()){
Thread.sleep(1);