Program: 106074
Project: 106074
Buggy source:
@Override public PrimaryDataStoreInfo createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException, UnknownHostException, ResourceUnavailableException {
  String providerName=cmd.getStorageProviderName();
  DataStoreProvider storeProvider=dataStoreProviderMgr.getDataStoreProvider(providerName);
  if (storeProvider == null) {
    storeProvider=dataStoreProviderMgr.getDefaultPrimaryDataStoreProvider();
    if (storeProvider == null) {
      throw new InvalidParameterValueException("String_Node_Str" + providerName);
    }
  }
  Long clusterId=cmd.getClusterId();
  Long podId=cmd.getPodId();
  Long zoneId=cmd.getZoneId();
  ScopeType scopeType=ScopeType.CLUSTER;
  String scope=cmd.getScope();
  if (scope != null) {
    try {
      scopeType=Enum.valueOf(ScopeType.class,scope.toUpperCase());
    }
 catch (    Exception e) {
      throw new InvalidParameterValueException("String_Node_Str" + scope);
    }
  }
  if (scopeType == ScopeType.CLUSTER && clusterId == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
 else   if (scopeType == ScopeType.ZONE && zoneId == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  HypervisorType hypervisorType=HypervisorType.KVM;
  if (scopeType == ScopeType.ZONE) {
    clusterId=null;
    podId=null;
    String hypervisor=cmd.getHypervisor();
    if (hypervisor != null) {
      try {
        hypervisorType=HypervisorType.getType(hypervisor);
      }
 catch (      Exception e) {
        throw new InvalidParameterValueException("String_Node_Str" + hypervisor);
      }
    }
 else {
      throw new InvalidParameterValueException("String_Node_Str");
    }
    if (hypervisorType != HypervisorType.KVM && hypervisorType != HypervisorType.VMware && hypervisorType != HypervisorType.Any) {
      throw new InvalidParameterValueException("String_Node_Str" + hypervisor);
    }
  }
  Map<String,String> details=extractApiParamAsMap(cmd.getDetails());
  DataCenterVO zone=_dcDao.findById(cmd.getZoneId());
  if (zone == null) {
    throw new InvalidParameterValueException("String_Node_Str" + zoneId);
  }
  Account account=CallContext.current().getCallingAccount();
  if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(account.getType())) {
    throw new PermissionDeniedException("String_Node_Str" + zoneId);
  }
  Map<String,Object> params=new HashMap<String,Object>();
  params.put("String_Node_Str",zone.getId());
  params.put("String_Node_Str",clusterId);
  params.put("String_Node_Str",podId);
  params.put("String_Node_Str",cmd.getUrl());
  params.put("String_Node_Str",cmd.getTags());
  params.put("String_Node_Str",cmd.getStoragePoolName());
  params.put("String_Node_Str",details);
  params.put("String_Node_Str",storeProvider.getName());
  params.put("String_Node_Str",cmd.isManaged());
  params.put("String_Node_Str",cmd.getCapacityBytes());
  params.put("String_Node_Str",cmd.getCapacityIops());
  DataStoreLifeCycle lifeCycle=storeProvider.getDataStoreLifeCycle();
  DataStore store=null;
  try {
    store=lifeCycle.initialize(params);
    if (scopeType == ScopeType.CLUSTER) {
      ClusterScope clusterScope=new ClusterScope(clusterId,podId,zoneId);
      lifeCycle.attachCluster(store,clusterScope);
    }
 else     if (scopeType == ScopeType.ZONE) {
      ZoneScope zoneScope=new ZoneScope(zoneId);
      lifeCycle.attachZone(store,zoneScope,hypervisorType);
    }
  }
 catch (  Exception e) {
    s_logger.debug("String_Node_Str",e);
    if (store != null) {
      lifeCycle.deleteDataStore(store);
    }
    throw new CloudRuntimeException("String_Node_Str",e);
  }
  return (PrimaryDataStoreInfo)dataStoreMgr.getDataStore(store.getId(),DataStoreRole.Primary);
}

Fixed version (ground truth):
@Override public PrimaryDataStoreInfo createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException, UnknownHostException, ResourceUnavailableException {
  String providerName=cmd.getStorageProviderName();
  DataStoreProvider storeProvider=dataStoreProviderMgr.getDataStoreProvider(providerName);
  if (storeProvider == null) {
    storeProvider=dataStoreProviderMgr.getDefaultPrimaryDataStoreProvider();
    if (storeProvider == null) {
      throw new InvalidParameterValueException("String_Node_Str" + providerName);
    }
  }
  Long clusterId=cmd.getClusterId();
  Long podId=cmd.getPodId();
  Long zoneId=cmd.getZoneId();
  ScopeType scopeType=ScopeType.CLUSTER;
  String scope=cmd.getScope();
  if (scope != null) {
    try {
      scopeType=Enum.valueOf(ScopeType.class,scope.toUpperCase());
    }
 catch (    Exception e) {
      throw new InvalidParameterValueException("String_Node_Str" + scope);
    }
  }
  if (scopeType == ScopeType.CLUSTER && clusterId == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
 else   if (scopeType == ScopeType.ZONE && zoneId == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
  HypervisorType hypervisorType=HypervisorType.KVM;
  if (scopeType == ScopeType.ZONE) {
    clusterId=null;
    podId=null;
    String hypervisor=cmd.getHypervisor();
    if (hypervisor != null) {
      try {
        hypervisorType=HypervisorType.getType(hypervisor);
      }
 catch (      Exception e) {
        throw new InvalidParameterValueException("String_Node_Str" + hypervisor);
      }
    }
 else {
      throw new InvalidParameterValueException("String_Node_Str");
    }
    if (hypervisorType != HypervisorType.KVM && hypervisorType != HypervisorType.VMware && hypervisorType != HypervisorType.Any) {
      throw new InvalidParameterValueException("String_Node_Str" + hypervisor);
    }
  }
  Map<String,String> details=extractApiParamAsMap(cmd.getDetails());
  DataCenterVO zone=_dcDao.findById(cmd.getZoneId());
  if (zone == null) {
    throw new InvalidParameterValueException("String_Node_Str" + zoneId);
  }
  Account account=CallContext.current().getCallingAccount();
  if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(account.getType())) {
    throw new PermissionDeniedException("String_Node_Str" + zoneId);
  }
  Map<String,Object> params=new HashMap<String,Object>();
  params.put("String_Node_Str",zone.getId());
  params.put("String_Node_Str",clusterId);
  params.put("String_Node_Str",podId);
  params.put("String_Node_Str",cmd.getUrl());
  params.put("String_Node_Str",cmd.getTags());
  params.put("String_Node_Str",cmd.getStoragePoolName());
  params.put("String_Node_Str",details);
  params.put("String_Node_Str",storeProvider.getName());
  params.put("String_Node_Str",cmd.isManaged());
  params.put("String_Node_Str",cmd.getCapacityBytes());
  params.put("String_Node_Str",cmd.getCapacityIops());
  DataStoreLifeCycle lifeCycle=storeProvider.getDataStoreLifeCycle();
  DataStore store=null;
  try {
    store=lifeCycle.initialize(params);
    if (scopeType == ScopeType.CLUSTER) {
      ClusterScope clusterScope=new ClusterScope(clusterId,podId,zoneId);
      lifeCycle.attachCluster(store,clusterScope);
    }
 else     if (scopeType == ScopeType.ZONE) {
      ZoneScope zoneScope=new ZoneScope(zoneId);
      lifeCycle.attachZone(store,zoneScope,hypervisorType);
    }
  }
 catch (  Exception e) {
    s_logger.debug("String_Node_Str" + e.getMessage(),e);
    if (store != null) {
      lifeCycle.deleteDataStore(store);
    }
    throw new CloudRuntimeException("String_Node_Str" + e.getMessage(),e);
  }
  return (PrimaryDataStoreInfo)dataStoreMgr.getDataStore(store.getId(),DataStoreRole.Primary);
}