Validates the given metric and tags.

@throws IllegalArgumentException
if any of the arguments aren't valid.
321344
static void checkMetricAndTags(final String metric,
      final Map<String, String> tags) {
    if (tags.size() <= 0) {
      throw new IllegalArgumentException("Need at least one tag (metric="
          + metric + ", tags=" + tags + ')');
    } else if (tags.size() > Const.MAX_NUM_TAGS()) {
      throw new IllegalArgumentException("Too many tags: " + tags.size()
          + " maximum allowed: " + Const.MAX_NUM_TAGS() + ", tags: " + tags);
    }

    Tags.validateString("metric name", metric);
    for (final Map.Entry<String, String> tag : tags.entrySet()) {
      Tags.validateString("tag name with value [" + tag.getValue() + "]", 
          tag.getKey());
      Tags.validateString("tag value with key [" + tag.getKey() + "]", 
          tag.getValue());
    }
  }
713012
protected void validate() {
    // make sure that the source uri is set correctly.
    if (mSourceUri == null) {
      throw new BuilderException("Source must be set!");
    }

    // For local resource we require caller to specify statically generated resource id as a path.
    if (UriUtil.isLocalResourceUri(mSourceUri)) {
      if (!mSourceUri.isAbsolute()) {
        throw new BuilderException("Resource URI path must be absolute.");
      }
      if (mSourceUri.getPath().isEmpty()) {
        throw new BuilderException("Resource URI must not be empty");
      }
      try {
        Integer.parseInt(mSourceUri.getPath().substring(1));
      } catch (NumberFormatException ignored) {
        throw new BuilderException("Resource URI path must be a resource id.");
      }
    }

    // For local asset we require caller to specify absolute path of an asset, which will be
    // resolved by AssetManager relative to configured asset folder of an app.
    if (UriUtil.isLocalAssetUri(mSourceUri) && !mSourceUri.isAbsolute()) {
      throw new BuilderException("Asset URI path must be absolute.");
    }
  }
578150
protected void validate(final boolean isDomain) throws MojoDeploymentException {
        final boolean hasServerGroups = hasServerGroups();
        if (isDomain) {
            if (!hasServerGroups) {
                throw new MojoDeploymentException(
                        "Server is running in domain mode, but no server groups have been defined.");
            }
        } else if (hasServerGroups) {
            throw new MojoDeploymentException("Server is running in standalone mode, but server groups have been defined.");
        }
    }
447293
public void assertValid(String valueAsString) throws IllegalArgumentException {
		final T value = valueConverter.convert(valueAsString);
		for (Validator<T> validator : validators) {
			validator.assertValid(value);
		}
	}
102468
private static void validateCategories(String... categories) {

        for (String category : categories) {
            if (!category.matches(FCM_TOPIC_PATTERN)) {
                throw new IllegalArgumentException(String.format("%s does not match %s", category, FCM_TOPIC_PATTERN));
            }
        }
    }
207857
public void validate() throws IllegalArgumentException, IllegalAccessException {
        for (Field field : getClass().getDeclaredFields()) {
            if (CatalogType.class.isAssignableFrom(field.getType())) {
                CatalogType ct = (CatalogType) field.get(this);
                assert(ct.getCatalog() == getCatalog()) : ct.getCatalogPath() + " has wrong catalog";
            }
            if (CatalogReference.class.isAssignableFrom(field.getType())) {
                @SuppressWarnings("unchecked")
                CatalogReference<? extends CatalogType> cr = (CatalogReference<? extends CatalogType>) field.get(this);
                if (cr.m_value != null) {
                    assert(cr.m_value.getCatalog() == getCatalog()) : cr.m_value.getCatalogPath() + " has wrong catalog";
                }
            }
            if (CatalogMap.class.isAssignableFrom(field.getClass())) {
                @SuppressWarnings("unchecked")
                CatalogMap<? extends CatalogType> cm = (CatalogMap<? extends CatalogType>) field.get(this);
                for (CatalogType ct : cm) {
                    assert(ct.getCatalog() == getCatalog()) : ct.getCatalogPath() + " has wrong catalog";
                    ct.validate();
                }
            }
        }
    }
650813
private void validateArguments() throws BuildException {
    Path tempDir = getTempDir();

    if (tempDir == null) {
      throw new BuildException("Temporary directory cannot be null.");
    }
    
    if (Files.exists(tempDir)) {
      if (!Files.isDirectory(tempDir)) {
        throw new BuildException("Temporary directory is not a folder: " + tempDir.toAbsolutePath());
      }
    } else {
      try {
        Files.createDirectories(tempDir);
      } catch (IOException e) {
        throw new BuildException("Failed to create temporary folder: " + tempDir, e);
      }
    }
  }
914189
private void validate() {
        LibraryUtils.checkArgumentNotNull(config, "Configuration is null.");
        LibraryUtils.checkArgumentNotNull(eventsProcessor, "Events Processor is null.");
        LibraryUtils.checkArgumentNotNull(sourceFilter, "Source Filter is null.");
        LibraryUtils.checkArgumentNotNull(eventFilter, "Event Filter is null.");
        LibraryUtils.checkArgumentNotNull(progressReporter, "Progress Reporter is null.");
        LibraryUtils.checkArgumentNotNull(exceptionHandler, "Exception Handler is null.");
        LibraryUtils.checkArgumentNotNull(s3Manager, "S3 Manager is null.");
        LibraryUtils.checkArgumentNotNull(sqsManager, "SQS Manager is null.");
    }
89225
public void validate() {
    if (id == null || id.isEmpty()) {
      throw new IllegalArgumentException("missing or empty id");
    }
    Query.validateId(id);
    
    if (expr == null || expr.isEmpty()) {
      throw new IllegalArgumentException("missing or empty expr");
    }
    
    // parse it just to make sure we're happy and extract the variable names. 
    // Will throw JexlException
    parsed_expression = ExpressionIterator.JEXL_ENGINE.createScript(expr);
    variables = new HashSet<String>();
    for (final List<String> exp_list : 
      ExpressionIterator.JEXL_ENGINE.getVariables(parsed_expression)) {
      for (final String variable : exp_list) {
        variables.add(variable);
      }
    }
    
    // others are optional
    if (join == null) {
      join = Join.Builder().setOperator(SetOperator.UNION).build();
    }
  }
874250
@SuppressWarnings("unchecked")
    protected void validate() {

        if (m_ou == null) {
            m_name.removeAllValidators();
            m_name.addValidator(new NameValidator());
        }
        m_description.setRequired(true);
        m_description.setRequiredError("Required");

        if (m_ouResources.getRows().isEmpty() & !m_webuser.getValue().booleanValue()) {
            CmsPathSelectField field = new CmsPathSelectField();
            field.setUseRootPaths(true);
            field.setCmsObject(m_cms);
            m_ouResources.addRow(field);
        }
        for (I_CmsEditableGroupRow row : m_ouResources.getRows()) {
            ((AbstractField<String>)row.getComponent()).removeAllValidators();
            ((AbstractField<String>)row.getComponent()).addValidator(new ResourceValidator());
        }
    }
1215246
@Override
    public void validate() {
        if (value == null) {
            throw new NoValueGivenException(getPath());
        }

        if (valids.size() != 0) {
            boolean ok = false;
            String valString = (value != null) ? value.toString() : "";

            for (int i = 0; i < valids.size(); i++) {
                if (valids.get(i).equals(valString)) {
                    ok = true;
                    break;
                }
            }

            if (!ok) {
                throw new NoValidValueException(getPath(), valString);
            }
        }

        setValid(true);
    }
1152879
public static void validArgument(boolean expression, String message, Object... messageArgs) {
    if (!expression) {
      throw new IllegalArgumentException(format(message, messageArgs));
    }
  }
1020089
protected static void checkMetricLabelName(String name) {
    if (!METRIC_LABEL_NAME_RE.matcher(name).matches()) {
      throw new IllegalArgumentException("Invalid metric label name: " + name);
    }
    if (RESERVED_METRIC_LABEL_NAME_RE.matcher(name).matches()) {
      throw new IllegalArgumentException("Invalid metric label name, reserved for internal use: " + name);
    }
  }
294626
@Override
    protected void implementationSpecificPut(List<Metric> metrics,
                                             Set<String> scopeNames,
                                             Set<Pair<String, String>> scopesAndMetricNames,
                                             Map<String, MetatagsRecord> metatagsToPut) {
        requireNotDisposed();
        SystemAssert.requireArgument(metrics != null, "Metric list cannot be null.");

        for (Metric metric : metrics) {
            if (metric.getTags().isEmpty()) {
                _putWithoutTag(metric);
            }

            for (Entry<String, String> tag : metric.getTags().entrySet()) {
                _putWithTag(metric, tag);
            }
        }
    }
807100
protected void validate() {
        Assert.checkNotNullParam("endpoint", endpoint);
        Assert.checkNotNullParam("optionMap", optionMap);
        Assert.checkNotNullParam("uri", uri);
    }
755093
private static void validate(String name, Collection<Geometry> geometries, int extent) {
        if (name == null) {
            throw new IllegalArgumentException("layer name is null");
        }
        if (geometries == null) {
            throw new IllegalArgumentException("geometry collection is null");
        }
        if (extent <= 0) {
            throw new IllegalArgumentException("extent is less than or equal to 0");
        }
    }
77130
public static void checkFlagsArgument(final int requestedFlags, final int allowedFlags) {
        if ((requestedFlags & allowedFlags) != requestedFlags) {
            throw new IllegalArgumentException("Requested flags 0x"
                    + Integer.toHexString(requestedFlags) + ", but only 0x"
                    + Integer.toHexString(allowedFlags) + " are allowed");
        }
    }