Source:
<code>public static boolean isClusterSetup(String clusterName, RealmAwareZkClient zkClient) { if (clusterName == null) { logger.info("Fail to check cluster setup : cluster name is null!"); return false; } if (zkClient == null) { logger.info("Fail to check cluster setup : zookeeper client is null!"); return false; } <START> ArrayList<String> requiredPaths = new ArrayList<>(); <END> requiredPaths.add(PropertyPathBuilder.idealState(clusterName)); requiredPaths.add(PropertyPathBuilder.clusterConfig(clusterName)); requiredPaths.add(PropertyPathBuilder.instanceConfig(clusterName)); requiredPaths.add(PropertyPathBuilder.resourceConfig(clusterName)); requiredPaths.add(PropertyPathBuilder.propertyStore(clusterName)); requiredPaths.add(PropertyPathBuilder.liveInstance(clusterName)); requiredPaths.add(PropertyPathBuilder.instance(clusterName)); requiredPaths.add(PropertyPathBuilder.externalView(clusterName)); requiredPaths.add(PropertyPathBuilder.controller(clusterName)); requiredPaths.add(PropertyPathBuilder.stateModelDef(clusterName)); requiredPaths.add(PropertyPathBuilder.controllerMessage(clusterName)); requiredPaths.add(PropertyPathBuilder.controllerError(clusterName)); requiredPaths.add(PropertyPathBuilder.controllerStatusUpdate(clusterName)); requiredPaths.add(PropertyPathBuilder.controllerHistory(clusterName)); boolean isValid = true; boolean[] ret = new boolean[requiredPaths.size()]; for (int i = 0; i < requiredPaths.size(); i++) { ret[i] = zkClient.exists(requiredPaths.get(i)); } StringBuilder errorMsg = new StringBuilder(); for (int i = 0; i < ret.length; i++) { if (!ret[i]) { isValid = false; errorMsg.append("Invalid cluster setup, missing znode path: ").append(requiredPaths.get(i)) .append("\n"); } } if (!isValid) { logger.debug(errorMsg.toString()); } return isValid; }</code><technical_language>Nit, declare type List<></technical_language>

Target:
public static boolean isClusterSetup(String clusterName, RealmAwareZkClient zkClient) { if (clusterName == null) { logger.info("Fail to check cluster setup : cluster name is null!"); return false; } if (zkClient == null) { logger.info("Fail to check cluster setup : zookeeper client is null!"); return false; } List<String> requiredPaths = new ArrayList<>(); requiredPaths.add(PropertyPathBuilder.idealState(clusterName)); requiredPaths.add(PropertyPathBuilder.clusterConfig(clusterName)); requiredPaths.add(PropertyPathBuilder.instanceConfig(clusterName)); requiredPaths.add(PropertyPathBuilder.resourceConfig(clusterName)); requiredPaths.add(PropertyPathBuilder.propertyStore(clusterName)); requiredPaths.add(PropertyPathBuilder.liveInstance(clusterName)); requiredPaths.add(PropertyPathBuilder.instance(clusterName)); requiredPaths.add(PropertyPathBuilder.externalView(clusterName)); requiredPaths.add(PropertyPathBuilder.controller(clusterName)); requiredPaths.add(PropertyPathBuilder.stateModelDef(clusterName)); requiredPaths.add(PropertyPathBuilder.controllerMessage(clusterName)); requiredPaths.add(PropertyPathBuilder.controllerError(clusterName)); requiredPaths.add(PropertyPathBuilder.controllerStatusUpdate(clusterName)); requiredPaths.add(PropertyPathBuilder.controllerHistory(clusterName)); boolean isValid = true; boolean[] ret = new boolean[requiredPaths.size()]; for (int i = 0; i < requiredPaths.size(); i++) { try { ret[i] = zkClient.exists(requiredPaths.get(i)); } catch (Exception e) { ret[i] = false; } } StringBuilder errorMsg = new StringBuilder(); for (int i = 0; i < ret.length; i++) { if (!ret[i]) { isValid = false; errorMsg.append("Invalid cluster setup, missing znode path: ").append(requiredPaths.get(i)) .append("\n"); } } if (!isValid) { logger.debug(errorMsg.toString()); } return isValid; }