Program: 115946
Project: 115946
Buggy source:
private ClusterLevelNetworkPartitionContext parseDeploymentPolicy(ClusterInstance clusterInstance,Cluster cluster,ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext,boolean hasGroupScalingDependent,boolean groupScalingEnabledSubtree) throws PolicyValidationException, PartitionValidationException {
  String deploymentPolicyName=AutoscalerUtil.getDeploymentPolicyIdByAlias(cluster.getAppId(),AutoscalerUtil.getAliasFromClusterId(clusterId));
  DeploymentPolicy deploymentPolicy;
  try {
    deploymentPolicy=CloudControllerServiceClient.getInstance().getDeploymentPolicy(deploymentPolicyName);
  }
 catch (  Exception e) {
    String msg=String.format("String_Node_Str",deploymentPolicyName);
    log.error(msg,e);
    throw new AutoScalerException(msg,e);
  }
  NetworkPartitionRef[] networkPartitionRefs=deploymentPolicy.getNetworkPartitionsRef();
  PartitionRef[] partitionRefs=null;
  if (networkPartitionRefs != null && networkPartitionRefs.length != 0) {
    for (    NetworkPartitionRef networkPartitionRef : networkPartitionRefs) {
      if (networkPartitionRef.getId().equals(clusterLevelNetworkPartitionContext.getId())) {
        partitionRefs=networkPartitionRef.getPartitions();
      }
    }
  }
  if (partitionRefs == null) {
    String msg="String_Node_Str" + clusterInstance.getAlias();
    log.error(msg);
    throw new PolicyValidationException(msg);
  }
  NetworkPartitionRef networkPartitionRef=null;
  if (networkPartitionRefs != null && networkPartitionRefs.length != 0) {
    for (    NetworkPartitionRef networkPartitionRef2 : networkPartitionRefs) {
      if (networkPartitionRef2.getId().equals(clusterInstance.getNetworkPartitionId())) {
        networkPartitionRef=networkPartitionRef2;
      }
    }
  }
  if (networkPartitionRef != null) {
    for (    PartitionRef partitionRef : networkPartitionRef.getPartitions()) {
      addPartition(clusterInstance,cluster,clusterLevelNetworkPartitionContext,partitionRef,hasGroupScalingDependent,groupScalingEnabledSubtree);
    }
  }
  return clusterLevelNetworkPartitionContext;
}

Fixed version (ground truth):
private ClusterLevelNetworkPartitionContext parseDeploymentPolicy(ClusterInstance clusterInstance,Cluster cluster,ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext,boolean hasGroupScalingDependent,boolean groupScalingEnabledSubtree) throws PolicyValidationException, PartitionValidationException {
  String deploymentPolicyName=AutoscalerUtil.getDeploymentPolicyIdByAlias(cluster.getAppId(),AutoscalerUtil.getAliasFromClusterId(clusterId));
  DeploymentPolicy deploymentPolicy;
  try {
    deploymentPolicy=CloudControllerServiceClient.getInstance().getDeploymentPolicy(deploymentPolicyName);
  }
 catch (  Exception e) {
    String msg=String.format("String_Node_Str",deploymentPolicyName);
    log.error(msg,e);
    throw new AutoScalerException(msg,e);
  }
  NetworkPartitionRef[] networkPartitionRefs=deploymentPolicy.getNetworkPartitionsRef();
  PartitionRef[] partitionRefs=null;
  if (networkPartitionRefs != null && networkPartitionRefs.length != 0) {
    for (    NetworkPartitionRef networkPartitionRef : networkPartitionRefs) {
      if (networkPartitionRef.getId().equals(clusterLevelNetworkPartitionContext.getId())) {
        partitionRefs=networkPartitionRef.getPartitions();
      }
    }
  }
  if (partitionRefs == null) {
    String msg="String_Node_Str" + AutoscalerUtil.getAliasFromClusterId(clusterId);
    log.error(msg);
    throw new PolicyValidationException(msg);
  }
  NetworkPartitionRef networkPartitionRef=null;
  if (networkPartitionRefs != null && networkPartitionRefs.length != 0) {
    for (    NetworkPartitionRef networkPartitionRef2 : networkPartitionRefs) {
      if (networkPartitionRef2.getId().equals(clusterInstance.getNetworkPartitionId())) {
        networkPartitionRef=networkPartitionRef2;
      }
    }
  }
  if (networkPartitionRef != null) {
    for (    PartitionRef partitionRef : networkPartitionRef.getPartitions()) {
      addPartition(clusterInstance,cluster,clusterLevelNetworkPartitionContext,partitionRef,hasGroupScalingDependent,groupScalingEnabledSubtree);
    }
  }
  return clusterLevelNetworkPartitionContext;
}