Program: 116228
Project: 116228
Buggy source:
private ClusterLevelNetworkPartitionContext addPartition(ClusterInstance clusterInstance,Cluster cluster,ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext) throws PolicyValidationException, PartitionValidationException {
  ChildLevelNetworkPartition networkPartition=deploymentPolicy.getChildLevelNetworkPartition(clusterInstance.getNetworkPartitionId());
  if (networkPartition == null) {
    String msg="String_Node_Str" + deploymentPolicy.getId();
    log.error(msg);
    throw new PolicyValidationException(msg);
  }
  ChildLevelPartition partition=networkPartition.getChildLevelPartition(clusterInstance.getPartitionId());
  if (partition == null) {
    String msg="String_Node_Str" + clusterInstance.getPartitionId() + "String_Node_Str"+ clusterInstance.getNetworkPartitionId()+ "String_Node_Str"+ "String_Node_Str"+ deploymentPolicy.getId();
    log.error(msg);
    throw new PolicyValidationException(msg);
  }
  Partition partition1=deploymentPolicy.getApplicationLevelNetworkPartition(networkPartition.getId()).getPartition(partition.getPartitionId());
  CloudControllerClient.getInstance().validatePartition(convertTOCCPartition(partition1));
  if (clusterLevelNetworkPartitionContext == null) {
    clusterLevelNetworkPartitionContext=new ClusterLevelNetworkPartitionContext(clusterInstance.getNetworkPartitionId(),networkPartition.getPartitionAlgo(),networkPartition.getMin());
  }
  ClusterLevelPartitionContext clusterLevelPartitionContext=new ClusterLevelPartitionContext(0);
  clusterLevelPartitionContext.setServiceName(cluster.getServiceName());
  clusterLevelPartitionContext.setProperties(cluster.getProperties());
  clusterLevelPartitionContext.setNetworkPartitionId(networkPartition.getId());
  addMembersFromTopology(cluster,partition1,clusterLevelPartitionContext);
  ClusterInstanceContext clusterInstanceContext=clusterLevelNetworkPartitionContext.getClusterInstanceContext(clusterInstance.getInstanceId());
  if (clusterInstanceContext == null) {
    clusterInstanceContext=new ClusterInstanceContext(clusterInstance.getInstanceId(),networkPartition.getPartitionAlgo(),networkPartition.getChildLevelPartitions(),networkPartition.getMin());
  }
  clusterInstanceContext.addPartitionCtxt(clusterLevelPartitionContext);
  clusterLevelNetworkPartitionContext.addClusterInstanceContext(clusterInstanceContext);
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",clusterLevelPartitionContext.getPartitionId()));
  }
  return clusterLevelNetworkPartitionContext;
}

Fixed version (ground truth):
private ClusterLevelNetworkPartitionContext addPartition(ClusterInstance clusterInstance,Cluster cluster,ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext) throws PolicyValidationException, PartitionValidationException {
  ChildLevelNetworkPartition networkPartition=deploymentPolicy.getChildLevelNetworkPartition(clusterInstance.getNetworkPartitionId());
  if (networkPartition == null) {
    String msg="String_Node_Str" + deploymentPolicy.getId();
    log.error(msg);
    throw new PolicyValidationException(msg);
  }
  ChildLevelPartition partition=networkPartition.getChildLevelPartition(clusterInstance.getPartitionId());
  if (partition == null) {
    String msg="String_Node_Str" + clusterInstance.getPartitionId() + "String_Node_Str"+ clusterInstance.getNetworkPartitionId()+ "String_Node_Str"+ "String_Node_Str"+ deploymentPolicy.getId();
    log.error(msg);
    throw new PolicyValidationException(msg);
  }
  Partition partition1=deploymentPolicy.getApplicationLevelNetworkPartition(networkPartition.getId()).getPartition(partition.getPartitionId());
  CloudControllerClient.getInstance().validatePartition(convertTOCCPartition(partition1));
  if (clusterLevelNetworkPartitionContext == null) {
    clusterLevelNetworkPartitionContext=new ClusterLevelNetworkPartitionContext(clusterInstance.getNetworkPartitionId(),networkPartition.getPartitionAlgo(),networkPartition.getMin());
  }
  ClusterLevelPartitionContext clusterLevelPartitionContext=new ClusterLevelPartitionContext(0);
  clusterLevelPartitionContext.setServiceName(cluster.getServiceName());
  clusterLevelPartitionContext.setProperties(cluster.getProperties());
  clusterLevelPartitionContext.setNetworkPartitionId(networkPartition.getId());
  addMembersFromTopology(cluster,partition1,clusterLevelPartitionContext);
  ClusterInstanceContext clusterInstanceContext=clusterLevelNetworkPartitionContext.getClusterInstanceContext(clusterInstance.getInstanceId());
  ApplicationHolder.acquireReadLock();
  try {
    Application application=ApplicationHolder.getApplications().getApplication(cluster.getAppId());
    ClusterDataHolder dataHolder=application.getClusterData(AutoscalerUtil.getAliasFromClusterId(clusterId));
    clusterInstanceContext.setMinMembers(dataHolder.getMinInstances());
    clusterInstanceContext.setMaxMembers(dataHolder.getMaxInstances());
  }
  finally {
    ApplicationHolder.releaseReadLock();
  }
  if (clusterInstanceContext == null) {
    clusterInstanceContext=new ClusterInstanceContext(clusterInstance.getInstanceId(),networkPartition.getPartitionAlgo(),networkPartition.getChildLevelPartitions(),networkPartition.getMin());
  }
  clusterInstanceContext.addPartitionCtxt(clusterLevelPartitionContext);
  clusterLevelNetworkPartitionContext.addClusterInstanceContext(clusterInstanceContext);
  if (log.isInfoEnabled()) {
    log.info(String.format("String_Node_Str",clusterLevelPartitionContext.getPartitionId()));
  }
  return clusterLevelNetworkPartitionContext;
}