Program: 116530
Project: 116530
Buggy source:
@Override public boolean validateDeploymentPolicy(String cartridgeType,Partition[] partitions) throws InvalidPartitionException, InvalidCartridgeTypeException {
  Map<String,List<String>> validatedCache=dataHolder.getCartridgeTypeToPartitionIds();
  List<String> validatedPartitions=new ArrayList<String>();
  if (validatedCache.containsKey(cartridgeType)) {
    validatedPartitions=validatedCache.get(cartridgeType);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + cartridgeType);
    }
  }
  Map<String,IaasProvider> partitionToIaasProviders=new ConcurrentHashMap<String,IaasProvider>();
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + cartridgeType);
  }
  Cartridge cartridge=dataHolder.getCartridge(cartridgeType);
  if (cartridge == null) {
    String msg="String_Node_Str" + cartridgeType;
    log.error(msg);
    throw new InvalidCartridgeTypeException(msg);
  }
  Map<String,Future<IaasProvider>> jobList=new HashMap<String,Future<IaasProvider>>();
  for (  Partition partition : partitions) {
    if (validatedPartitions.contains(partition.getId())) {
      continue;
    }
    Callable<IaasProvider> worker=new PartitionValidatorCallable(partition,cartridge);
    Future<IaasProvider> job=FasterLookUpDataHolder.getInstance().getExecutor().submit(worker);
    jobList.put(partition.getId(),job);
  }
  for (  String partitionId : jobList.keySet()) {
    Future<IaasProvider> job=jobList.get(partitionId);
    try {
      partitionToIaasProviders.put(partitionId,job.get());
      this.dataHolder.addToCartridgeTypeToPartitionIdMap(cartridgeType,partitionId);
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + partitionId + "String_Node_Str"+ cartridgeType);
      }
    }
 catch (    Exception e) {
      log.error(e.getMessage(),e);
      throw new InvalidPartitionException(e.getMessage(),e);
    }
  }
  cartridge.addIaasProviders(partitionToIaasProviders);
  persist();
  log.info("String_Node_Str" + CloudControllerUtil.getPartitionIds(partitions) + "String_Node_Str"+ cartridgeType);
  return true;
}

Fixed version (ground truth):
@Override public boolean validateDeploymentPolicy(String cartridgeType,Partition[] partitions) throws InvalidPartitionException, InvalidCartridgeTypeException {
  Map<String,List<String>> validatedCache=dataHolder.getCartridgeTypeToPartitionIds();
  List<String> validatedPartitions=new ArrayList<String>();
  if (validatedCache.containsKey(cartridgeType)) {
    validatedPartitions=validatedCache.get(cartridgeType);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + cartridgeType);
    }
  }
  Map<String,IaasProvider> partitionToIaasProviders=new ConcurrentHashMap<String,IaasProvider>();
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + cartridgeType);
  }
  Cartridge cartridge=dataHolder.getCartridge(cartridgeType);
  if (cartridge == null) {
    String msg="String_Node_Str" + cartridgeType;
    log.error(msg);
    throw new InvalidCartridgeTypeException(msg);
  }
  Map<String,Future<IaasProvider>> jobList=new HashMap<String,Future<IaasProvider>>();
  for (  Partition partition : partitions) {
    if (validatedPartitions.contains(partition.getId())) {
      continue;
    }
    Callable<IaasProvider> worker=new PartitionValidatorCallable(partition,cartridge);
    Future<IaasProvider> job=FasterLookUpDataHolder.getInstance().getExecutor().submit(worker);
    jobList.put(partition.getId(),job);
  }
  for (  Entry<String,Future<IaasProvider>> entry : jobList.entrySet()) {
    if (entry == null) {
      continue;
    }
    String partitionId=entry.getKey();
    Future<IaasProvider> job=entry.getValue();
    try {
      partitionToIaasProviders.put(partitionId,job.get());
      this.dataHolder.addToCartridgeTypeToPartitionIdMap(cartridgeType,partitionId);
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + partitionId + "String_Node_Str"+ cartridgeType);
      }
    }
 catch (    Exception e) {
      log.error(e.getMessage(),e);
      throw new InvalidPartitionException(e.getMessage(),e);
    }
  }
  cartridge.addIaasProviders(partitionToIaasProviders);
  persist();
  log.info("String_Node_Str" + CloudControllerUtil.getPartitionIds(partitions) + "String_Node_Str"+ cartridgeType);
  return true;
}