Program: 89397
Project: 89397
Buggy source:
@Override public UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone,ServiceOffering serviceOffering,VirtualMachineTemplate template,List<Long> securityGroupIdList,Account owner,String hostName,String displayName,Long diskOfferingId,Long diskSize,String group,HypervisorType hypervisor,String userData,String sshKeyPair,Map<Long,String> requestedIps,String defaultIp) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
  Account caller=UserContext.current().getCaller();
  List<NetworkVO> networkList=new ArrayList<NetworkVO>();
  _accountMgr.checkAccess(caller,owner);
  Network defaultNetwork=_networkMgr.getSystemNetworkByZoneAndTrafficType(zone.getId(),TrafficType.Guest);
  if (defaultNetwork == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
 else {
    networkList.add(_networkDao.findById(defaultNetwork.getId()));
  }
  boolean isVmWare=(template.getHypervisorType() == HypervisorType.VMware || (hypervisor != null && hypervisor == HypervisorType.VMware));
  if (securityGroupIdList != null && isVmWare) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
 else   if (!isVmWare) {
    if (securityGroupIdList == null) {
      securityGroupIdList=new ArrayList<Long>();
    }
    SecurityGroup defaultGroup=_securityGroupMgr.getDefaultSecurityGroup(owner.getId());
    if (defaultGroup != null) {
      boolean defaultGroupPresent=false;
      for (      Long securityGroupId : securityGroupIdList) {
        if (securityGroupId.longValue() == defaultGroup.getId()) {
          defaultGroupPresent=true;
          break;
        }
      }
      if (!defaultGroupPresent) {
        securityGroupIdList.add(defaultGroup.getId());
      }
    }
 else {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + owner + "String_Node_Str");
      }
      defaultGroup=_securityGroupMgr.createSecurityGroup(SecurityGroupManager.DEFAULT_GROUP_NAME,SecurityGroupManager.DEFAULT_GROUP_DESCRIPTION,owner.getDomainId(),owner.getId(),owner.getAccountName());
      securityGroupIdList.add(defaultGroup.getId());
    }
  }
  return createVirtualMachine(zone,serviceOffering,template,hostName,displayName,owner,diskOfferingId,diskSize,networkList,securityGroupIdList,group,userData,sshKeyPair,hypervisor,caller,requestedIps,defaultIp);
}

Fixed version (ground truth):
@Override public UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone,ServiceOffering serviceOffering,VirtualMachineTemplate template,List<Long> securityGroupIdList,Account owner,String hostName,String displayName,Long diskOfferingId,Long diskSize,String group,HypervisorType hypervisor,String userData,String sshKeyPair,Map<Long,String> requestedIps,String defaultIp,String keyboard) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException {
  Account caller=UserContext.current().getCaller();
  List<NetworkVO> networkList=new ArrayList<NetworkVO>();
  _accountMgr.checkAccess(caller,owner);
  Network defaultNetwork=_networkMgr.getSystemNetworkByZoneAndTrafficType(zone.getId(),TrafficType.Guest);
  if (defaultNetwork == null) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
 else {
    networkList.add(_networkDao.findById(defaultNetwork.getId()));
  }
  boolean isVmWare=(template.getHypervisorType() == HypervisorType.VMware || (hypervisor != null && hypervisor == HypervisorType.VMware));
  if (securityGroupIdList != null && isVmWare) {
    throw new InvalidParameterValueException("String_Node_Str");
  }
 else   if (!isVmWare) {
    if (securityGroupIdList == null) {
      securityGroupIdList=new ArrayList<Long>();
    }
    SecurityGroup defaultGroup=_securityGroupMgr.getDefaultSecurityGroup(owner.getId());
    if (defaultGroup != null) {
      boolean defaultGroupPresent=false;
      for (      Long securityGroupId : securityGroupIdList) {
        if (securityGroupId.longValue() == defaultGroup.getId()) {
          defaultGroupPresent=true;
          break;
        }
      }
      if (!defaultGroupPresent) {
        securityGroupIdList.add(defaultGroup.getId());
      }
    }
 else {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + owner + "String_Node_Str");
      }
      defaultGroup=_securityGroupMgr.createSecurityGroup(SecurityGroupManager.DEFAULT_GROUP_NAME,SecurityGroupManager.DEFAULT_GROUP_DESCRIPTION,owner.getDomainId(),owner.getId(),owner.getAccountName());
      securityGroupIdList.add(defaultGroup.getId());
    }
  }
  return createVirtualMachine(zone,serviceOffering,template,hostName,displayName,owner,diskOfferingId,diskSize,networkList,securityGroupIdList,group,userData,sshKeyPair,hypervisor,caller,requestedIps,defaultIp,keyboard);
}