Program: 115621
Project: 115621
Buggy source:
private void validateDeploymentPolicy(DeploymentPolicy deploymentPolicy) throws InvalidDeploymentPolicyException, RemoteException {
  if (null == deploymentPolicy) {
    String msg="String_Node_Str";
    log.error(msg);
    throw new InvalidDeploymentPolicyException(msg);
  }
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",deploymentPolicy.toString()));
  }
  String deploymentPolicyId=deploymentPolicy.getDeploymentPolicyID();
  if (StringUtils.isBlank(deploymentPolicyId)) {
    String msg=String.format("String_Node_Str");
    log.error(msg);
    throw new InvalidDeploymentPolicyException(msg);
  }
  if (null == deploymentPolicy.getNetworkPartitionRefs() || deploymentPolicy.getNetworkPartitionRefs().length == 0) {
    String msg=String.format("String_Node_Str" + "String_Node_Str",deploymentPolicyId);
    log.error(msg);
    throw new InvalidDeploymentPolicyException(msg);
  }
  for (  NetworkPartitionRef networkPartitionRef : deploymentPolicy.getNetworkPartitionRefs()) {
    String networkPartitionId=networkPartitionRef.getId();
    if (StringUtils.isBlank(networkPartitionId)) {
      String msg=String.format("String_Node_Str",deploymentPolicyId);
      log.error(msg);
      throw new InvalidDeploymentPolicyException(msg);
    }
    NetworkPartition networkPartition=CloudControllerServiceClient.getInstance().getNetworkPartition(networkPartitionId);
    if (networkPartition == null) {
      String msg=String.format("String_Node_Str" + "String_Node_Str",deploymentPolicyId,networkPartitionId);
      log.error(msg);
      throw new InvalidDeploymentPolicyException(msg);
    }
    String partitionAlgorithm=networkPartitionRef.getPartitionAlgo();
    if (StringUtils.isBlank(partitionAlgorithm)) {
      String msg=String.format("String_Node_Str" + "String_Node_Str",deploymentPolicyId,networkPartitionId,partitionAlgorithm);
      log.error(msg);
      throw new InvalidDeploymentPolicyException(msg);
    }
    if ((!StratosConstants.PARTITION_ROUND_ROBIN_ALGORITHM_ID.equals(partitionAlgorithm)) && (!StratosConstants.PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID.equals(partitionAlgorithm))) {
      String msg=String.format("String_Node_Str" + "String_Node_Str",deploymentPolicyId,networkPartitionId,partitionAlgorithm);
      log.error(msg);
      throw new InvalidDeploymentPolicyException(msg);
    }
    PartitionRef[] partitions=networkPartitionRef.getPartitionRefs();
    if (null == partitions || partitions.length == 0) {
      String msg=String.format("String_Node_Str" + "String_Node_Str",deploymentPolicyId,networkPartitionId);
      log.error(msg);
      throw new InvalidDeploymentPolicyException(msg);
    }
  }
}

Fixed version (ground truth):
private void validateDeploymentPolicy(DeploymentPolicy deploymentPolicy) throws InvalidDeploymentPolicyException, RemoteException {
  if (null == deploymentPolicy) {
    String msg="String_Node_Str";
    log.error(msg);
    throw new InvalidDeploymentPolicyException(msg);
  }
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",deploymentPolicy.toString()));
  }
  String deploymentPolicyId=deploymentPolicy.getDeploymentPolicyID();
  if (StringUtils.isBlank(deploymentPolicyId)) {
    String msg=String.format("String_Node_Str");
    log.error(msg);
    throw new InvalidDeploymentPolicyException(msg);
  }
  if (null == deploymentPolicy.getNetworkPartitionRefs() || deploymentPolicy.getNetworkPartitionRefs().length == 0) {
    String msg=String.format("String_Node_Str" + "String_Node_Str",deploymentPolicyId);
    log.error(msg);
    throw new InvalidDeploymentPolicyException(msg);
  }
  for (  NetworkPartitionRef networkPartitionRef : deploymentPolicy.getNetworkPartitionRefs()) {
    String networkPartitionId=networkPartitionRef.getId();
    if (StringUtils.isBlank(networkPartitionId)) {
      String msg=String.format("String_Node_Str",deploymentPolicyId);
      log.error(msg);
      throw new InvalidDeploymentPolicyException(msg);
    }
    NetworkPartition networkPartition=CloudControllerServiceClient.getInstance().getNetworkPartition(networkPartitionId);
    if (networkPartition == null) {
      String msg=String.format("String_Node_Str" + "String_Node_Str",deploymentPolicyId,networkPartitionId);
      log.error(msg);
      throw new InvalidDeploymentPolicyException(msg);
    }
    for (    PartitionRef partitionRef : networkPartitionRef.getPartitionRefs()) {
      String partitionId=partitionRef.getId();
      for (      Partition partition : networkPartition.getPartitions()) {
        if (!partition.getId().equals(partitionId)) {
          String msg=String.format("String_Node_Str" + "String_Node_Str",deploymentPolicyId,networkPartitionId,partitionId);
          log.error(msg);
          throw new InvalidDeploymentPolicyException(msg);
        }
      }
    }
    String partitionAlgorithm=networkPartitionRef.getPartitionAlgo();
    if (StringUtils.isBlank(partitionAlgorithm)) {
      String msg=String.format("String_Node_Str" + "String_Node_Str",deploymentPolicyId,networkPartitionId,partitionAlgorithm);
      log.error(msg);
      throw new InvalidDeploymentPolicyException(msg);
    }
    if ((!StratosConstants.PARTITION_ROUND_ROBIN_ALGORITHM_ID.equals(partitionAlgorithm)) && (!StratosConstants.PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID.equals(partitionAlgorithm))) {
      String msg=String.format("String_Node_Str" + "String_Node_Str",deploymentPolicyId,networkPartitionId,partitionAlgorithm);
      log.error(msg);
      throw new InvalidDeploymentPolicyException(msg);
    }
    PartitionRef[] partitions=networkPartitionRef.getPartitionRefs();
    if (null == partitions || partitions.length == 0) {
      String msg=String.format("String_Node_Str" + "String_Node_Str",deploymentPolicyId,networkPartitionId);
      log.error(msg);
      throw new InvalidDeploymentPolicyException(msg);
    }
  }
}