/*
(non-Javadoc)

@see
com.fs.commons.desktop.validation.Validator#validate(com.fs.commons.desktop.
validation.Problems, java.lang.String, java.lang.Object)
519619
@Override
	public boolean validate(final Problems problems, final String compName, final String text) {
		boolean invalid = text.contains(File.separator) || text.contains(File.pathSeparator);
		if (!invalid && Utilities.isWindows()) {
			invalid = text.contains(":");
		}
		final String result = invalid
				? ValidationBundle.getMessage(IllegalCharactersInFileNameValidator.class, "ERR_INVALID_FILE_NAME", compName, text)
				: null; // NOI18N
		if (result != null) {
			problems.add(result);
		}
		return !invalid;
	}
1339227
@Override
	public boolean validate(final Problems problems, final String compName, final String model) {
		if (model.length() > 0) {
			final char c = model.charAt(0);
			if (Character.isDigit(c)) {
				problems.add(ValidationBundle.getMessage(MayNotStartWithDigit.class, "MAY_NOT_START_WITH_DIGIT", compName)); // NOI18N
			}
		}
		return true;
	}
65180
public static void check(boolean isValid, String message, Object... args) {
    if (!isValid) {
      String[] argStrings = new String[args.length];
      for (int i = 0; i < args.length; i += 1) {
        argStrings[i] = String.valueOf(args[i]);
      }
      throw new ValidationException(
          String.format(String.valueOf(message), (Object[]) argStrings));
    }
  }
24103
public void validate() {
    if (interval == null || interval.isEmpty()) {
      throw new IllegalArgumentException("Missing or empty interval");
    }
    DateTime.parseDuration(interval);
    
    if (aggregator == null || aggregator.isEmpty()) {
      throw new IllegalArgumentException("Missing or empty aggregator");
    }
    try {
      Aggregators.get(aggregator.toLowerCase());
    } catch (final NoSuchElementException e) {
      throw new IllegalArgumentException("Invalid aggregator");
    }
    
    if (fill_policy != null) {
      fill_policy.validate();
    }
  }
1236932
public void validate(String origin) {
        List<String> problems = new ArrayList<>();
        if(source == null) {
            if(path == null) {
                problems.add("You must specify either path or source");
            } else if(method == null) {
                problems.add("You must specify method along with path: " + path);
            }
        } else {
            if(path != null) {
                problems.add("Conflicting source: " + source + " and path: " + path);
            }
            if(method != null) {
                problems.add("Conflicting source: " + source + " and method: " + method);
            }
        }
        if(method != null && !Util.METHODS.contains(method.toUpperCase())) {
            problems.add("Invalid HTTP method: " + method);
        }
        if(!problems.isEmpty()) {
            throw new RuntimeException("Bad paths element in " + origin + " [ " + String.join(" | ", problems) + " ]");
        }
    }
717946
@Override
	public boolean validate(final Problems problems, final String compName, final String model) {
		final String[] parts = model.split("\\.");
		boolean hasIntParts = false;
		boolean hasNonIntParts = false;
		if (model.indexOf(" ") > 0 || model.indexOf("\t") > 0) {
			problems.add(ValidationBundle.getMessage(ValidHostNameOrIPValidator.class, "HOST_MAY_NOT_CONTAIN_WHITESPACE", compName, model)); // NOI18N
			return false;
		}
		if (parts.length == 0) { // the string "."
			problems.add(ValidationBundle.getMessage(ValidHostNameOrIPValidator.class, "INVALID_HOST_OR_IP", compName, model)); // NOI18N
			return false;
		}
		for (int i = 0; i < parts.length; i++) {
			String s = parts[i];
			if (i == parts.length - 1 && s.contains(":")) { // NOI18N
				final String[] partAndPort = s.split(":"); // NOI18N
				if (partAndPort.length > 2) {
					problems.add(ValidationBundle.getMessage(ValidHostNameOrIPValidator.class, "TOO_MANY_COLONS", compName, model)); // NOI18N
					return false;
				}
				if (partAndPort.length == 0) { // the string ":"
					problems.add(ValidationBundle.getMessage(ValidHostNameOrIPValidator.class, "INVALID_HOST_OR_IP", compName, model)); // NOI18N
					return false;
				}
				s = partAndPort[0];
				if (partAndPort.length == 2) {
					try {
						Integer.parseInt(partAndPort[1]);
					} catch (final NumberFormatException nfe) {
						problems.add(ValidationBundle.getMessage(ValidHostNameOrIPValidator.class, "INVALID_PORT", compName, partAndPort[1])); // NOI18N
						return false;
					}
				}
			}
			try {
				Integer.parseInt(s);
				hasIntParts = true;
			} catch (final NumberFormatException nfe) {
				hasNonIntParts = true;
			}
			if (hasIntParts && hasNonIntParts) {
				problems.add(
						ValidationBundle.getMessage(ValidHostNameOrIPValidator.class, "ADDRESS_CONTAINS_INT_AND_NON_INT_LABELS", compName, model)); // NOI18N
				return false;
			}
		}

		final boolean validHost = hasNonIntParts && this.hostVal.validate(problems, compName, model);
		final boolean validIp = hasIntParts && this.ipVal.validate(problems, compName, model);
		return validHost || validIp;
	}
367128
@Override
  public void validate(T arg) throws ValidationException {
    for (final Validator<T> validator : validators) {
      validator.validate(arg);
    }
  }
236145
@Override
	public boolean validate(final Problems problems, final String compName, final String model) {
		final char[] chars = model.toCharArray();
		for (final char c : chars) {
			if (Character.isWhitespace(c)) {
				problems.add(ValidationBundle.getMessage(MayNotContainSpacesValidator.class, "MAY_NOT_CONTAIN_WHITESPACE", compName)); // NOI18N
				return false;
			}
		}
		return true;
	}
1039684
@Override
	public List<GigJavaProblem> validate(TypeDeclaration declaration,
			IType type, CompilationUnit unit, String file)
			throws JavaModelException {
		List<GigJavaProblem> problems = new ArrayList<GigJavaProblem>();
		int flags = type.getFlags();
		
		if (!Flags.isAbstract(flags)) {
			if (!Flags.isPublic(flags)) {
				GigJavaProblem problem = new GigJavaProblem(
						Severity.ERROR, "Concrete Component class must be public", file);
				ISourceRange range = type.getNameRange();
				int offset = range.getOffset();
				problem.setSourceStart(offset);
				problem.setSourceEnd(offset + range.getLength() - 1);
				problem.setSourceLineNumber(unit.getLineNumber(offset));
				problems.add(problem);
				return problems;
			}
		}
		
		return problems;
	}
39290
private void validate(JSONObject json) throws HelloSignException {
        if (json.has("error")) {
            try {
                JSONObject error = json.getJSONObject("error");
                String message = error.getString("error_msg");
                String type = error.getString("error_name");
                throw new HelloSignException(message, getLastResponseCode(), type);
            } catch (JSONException ex) {
                throw new HelloSignException(ex);
            }
        }
    }
404430
@Override
	public List<ParsingError> doValidate() {

		List<ParsingError> result = new ArrayList<> ();
		if( Utils.isEmptyOrWhitespaces( this.targetId ))
			result.add( error( ErrorCode.CMD_INVALID_TARGET_ID, value( this.targetId )));

		Instance resolvedInstance;
		if(( resolvedInstance = this.context.resolveInstance( this.scopedInstancePath )) == null)
			result.add( error( ErrorCode.CMD_NO_MATCHING_INSTANCE, instance( this.scopedInstancePath )));
		else if( ! InstanceHelpers.isTarget( resolvedInstance ))
			result.add( error( ErrorCode.CMD_NOT_A_SCOPED_INSTANCE ));

		return result;
	}
974684
@Override
	public void validate(final List<Diagnostic> diags) {
		// Validate each row.
		List beanList = this.getBeanList();
		WComponent row = getRepeatedComponent();

		for (int i = 0; i < beanList.size(); i++) {
			Object rowData = beanList.get(i);
			UIContext rowContext = getRowContext(rowData, i);

			UIContextHolder.pushContext(rowContext);

			try {
				row.validate(diags);
			} finally {
				UIContextHolder.popContext();
			}
		}
	}
75754
@Override
	public boolean validate(final Problems problems, final String compName, final String model) {
		for (final char c : this.chars) {
			for (final char cc : model.toCharArray()) {
				if (cc == c) {
					problems.add(ValidationBundle.getMessage(DisallowCharactersValidator.class, "DISALLOWED_CHARS", asString(), compName)); // NOI18N
					return false;
				}
			}
		}
		return true;
	}
1196041
@Override
  public void validate() {
    int n = 0;
    try {
      for (TiffObject o : model.getImageIfds()) {
        IFD ifd = (IFD) o;
        IfdTags metadata = ifd.getMetadata();
        validateMetadata(metadata);
        checkImage(ifd, n, metadata);
        n++;
      }
    } catch (Exception ex) {

    }
  }
1250051
@Override
    public void validate(final FacesContext context) {
        // iterate over submitted values and attempt to convert to the proper
        // data type. For successful values, remove from submitted and add to
        // local values map. for failures, add a conversion message and leave in
        // the submitted state
        final Iterator<Entry<SheetRowColIndex, String>> entries = submittedValues.entrySet().iterator();
        final boolean hadBadUpdates = !getInvalidUpdates().isEmpty();
        getInvalidUpdates().clear();
        while (entries.hasNext()) {
            final Entry<SheetRowColIndex, String> entry = entries.next();
            final SheetColumn column = getColumns().get(entry.getKey().getColIndex());
            final String newValue = entry.getValue();
            final String rowKey = entry.getKey().getRowKey();
            final int col = entry.getKey().getColIndex();
            setRowVar(context, rowKey);

            // attempt to convert new value from string to correct object type
            // based on column converter. Use PF util as helper
            final Converter converter = ComponentUtils.getConverter(context, column);

            // assume string value if converter not found
            Object newValueObj = newValue;
            if (converter != null) {
                try {
                    newValueObj = converter.getAsObject(context, this, newValue);
                }
                catch (final ConverterException e) {
                    // add offending cell to list of bad updates
                    // and to a StringBuilder for error messages (so we have one
                    // message for the component)
                    setValid(false);
                    FacesMessage message = e.getFacesMessage();
                    if (message == null) {
                        message = new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), e.getMessage());
                    }
                    context.addMessage(this.getClientId(context), message);

                    final String messageText = message.getDetail();
                    getInvalidUpdates()
                                .add(new SheetInvalidUpdate(getRowKeyValue(context), col, column, newValue, messageText));
                    continue;
                }
            }
            // value is fine, no further validations (again, not to be confused
            // with validators. until we have a "required" or something like
            // that, nothing else to do).
            setLocalValue(rowKey, col, newValueObj);

            // process validators on column
            column.setValue(newValueObj);
            try {
                column.validate(context);
            }
            finally {
                column.resetValue();
            }

            entries.remove();
        }
        setRowVar(context, null);

        final boolean newBadUpdates = !getInvalidUpdates().isEmpty();
        final String errorMessage = getErrorMessage();

        if (hadBadUpdates || newBadUpdates) {
            // update the bad data var if partial request
            if (context.getPartialViewContext().isPartialRequest()) {
                renderBadUpdateScript(context);
            }
        }

        if (newBadUpdates && errorMessage != null) {
            final FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, errorMessage, errorMessage);
            context.addMessage(null, message);
        }
    }
854191
@Override
    public void validate() {
        String target = getTargetName();
        //validate the parameters
        if (delay() < 0) {
            throw new FaultToleranceDefinitionException(Tr.formatMessage(tc, "circuitBreaker.parameter.delay.invalid.value.CWMFT5012E", "delay", delay(), target));
        }
        if ((failureRatio() < 0) || (failureRatio() > 1)) {
            throw new FaultToleranceDefinitionException(Tr.formatMessage(tc, "circuitBreaker.parameter.failureRatio.invalid.value.CWMFT5013E", "failureRatio",
                                                                         failureRatio(),
                                                                         target));
        }
        if (requestVolumeThreshold() < 1) {
            throw new FaultToleranceDefinitionException(Tr.formatMessage(tc, "circuitBreaker.parameter.requestVolumeThreshold.invalid.value.CWMFT5014E", "requestVolumeThreshold",
                                                                         requestVolumeThreshold(), target));
        }
        if (successThreshold() < 1) {
            throw new FaultToleranceDefinitionException(Tr.formatMessage(tc, "circuitBreaker.parameter.successThreshold.invalid.value.CWMFT5015E", "successThreshold",
                                                                         successThreshold(), target));
        }
        if (failOn().length == 0) {
            throw new FaultToleranceDefinitionException(Tr.formatMessage(tc, "circuitBreaker.parameter.failOn.invalid.value.CWMFT5018E", "failOn", target));
        }

    }
963267
public void addValidation(Object key, Validation validation){
        initMapOnce();
        validations.put(key, validation);
        // update aggregated value
        passedAll = passedAll && validation.passed();
    }