HBASE-5633 NPE reading ZK config in HBase

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1304924 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2012-03-24 21:15:40 +00:00
parent accf8ee862
commit 9cfe7cfa3c
2 changed files with 5 additions and 1 deletions

View File

@ -82,6 +82,9 @@ public final class HConstants {
/** Cluster is fully-distributed */
public static final String CLUSTER_IS_DISTRIBUTED = "true";
/** Default value for cluster distributed mode */
public static final String DEFAULT_CLUSTER_DISTRIBUTED = CLUSTER_IS_LOCAL;
/** default host address */
public static final String DEFAULT_HOST = "0.0.0.0";

View File

@ -163,7 +163,8 @@ public class ZKConfig {
}
// Special case for 'hbase.cluster.distributed' property being 'true'
if (key.startsWith("server.")) {
if (conf.get(HConstants.CLUSTER_DISTRIBUTED).equals(HConstants.CLUSTER_IS_DISTRIBUTED)
if (conf.get(HConstants.CLUSTER_DISTRIBUTED, HConstants.DEFAULT_CLUSTER_DISTRIBUTED).
equals(HConstants.CLUSTER_IS_DISTRIBUTED)
&& value.startsWith(HConstants.LOCALHOST)) {
String msg = "The server in zoo.cfg cannot be set to localhost " +
"in a fully-distributed setup because it won't be reachable. " +