Catch exception when no resource config exists (for 0.6.5)
Project: http://git-wip-us.apache.org/repos/asf/helix/repo Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/d301c6c0 Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/d301c6c0 Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/d301c6c0 Branch: refs/heads/master Commit: d301c6c02954ba8d47424109d6cf0dfb9c909ab4 Parents: 6cbafef Author: Greg Brandt <[email protected]> Authored: Sat Mar 28 12:28:51 2015 -0700 Committer: Greg Brandt <[email protected]> Committed: Sat Mar 28 12:28:51 2015 -0700 ---------------------------------------------------------------------- .../org/apache/helix/ui/util/DataCache.java | 35 ++++++++++++-------- 1 file changed, 22 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/helix/blob/d301c6c0/helix-ui/src/main/java/org/apache/helix/ui/util/DataCache.java ---------------------------------------------------------------------- diff --git a/helix-ui/src/main/java/org/apache/helix/ui/util/DataCache.java b/helix-ui/src/main/java/org/apache/helix/ui/util/DataCache.java index ff66a05..c96a718 100644 --- a/helix-ui/src/main/java/org/apache/helix/ui/util/DataCache.java +++ b/helix-ui/src/main/java/org/apache/helix/ui/util/DataCache.java @@ -9,11 +9,14 @@ import org.apache.helix.model.InstanceConfig; import org.apache.helix.model.builder.HelixConfigScopeBuilder; import org.apache.helix.tools.ClusterSetup; import org.apache.helix.ui.api.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.*; import java.util.concurrent.TimeUnit; public class DataCache { + private static final Logger LOG = LoggerFactory.getLogger(DataCache.class); private static final int CACHE_EXPIRY_TIME = 30; private static final TimeUnit CACHE_EXPIRY_UNIT = TimeUnit.SECONDS; @@ -90,19 +93,25 @@ public class DataCache { .forCluster(resourceSpec.getClusterName()) .forResource(resourceSpec.getResourceName()) .build(); - - List<String> clusterConfigKeys = clusterSetup.getClusterManagementTool().getConfigKeys(configScope); - - Map<String, String> config = clusterSetup.getClusterManagementTool().getConfig(configScope, clusterConfigKeys); - - if (config != null) { - for (Map.Entry<String, String> entry : config.entrySet()) { - configTable.add(new ConfigTableRow( - HelixConfigScope.ConfigScopeProperty.RESOURCE.toString(), - resourceSpec.getClusterName(), - entry.getKey(), - entry.getValue())); - } + try + { + List<String> clusterConfigKeys = clusterSetup.getClusterManagementTool().getConfigKeys(configScope); + + Map<String, String> config = clusterSetup.getClusterManagementTool().getConfig(configScope, clusterConfigKeys); + + if (config != null) { + for (Map.Entry<String, String> entry : config.entrySet()) { + configTable.add(new ConfigTableRow( + HelixConfigScope.ConfigScopeProperty.RESOURCE.toString(), + resourceSpec.getClusterName(), + entry.getKey(), + entry.getValue())); + } + } + } + catch (Exception e) + { + LOG.warn("Could not get resource config for {}", resourceSpec.getResourceName(), e); } return configTable;
