Note: As the input validations are only run one time in a stack,
this method is not overridable
480387
private function checkInput()
    {
        // Check if source exists
        if (!@file_exists($this->source)) {
            throw new TargetNotFoundException('File or directory not found: ' . $this->source);
        }

        // Check if the provided file's mime type is valid
        $fileMimeType = $this->getMimeTypeOfSource();
        if (is_null($fileMimeType)) {
            throw new InvalidImageTypeException('Image type could not be detected');
        } elseif ($fileMimeType === false) {
            throw new InvalidImageTypeException('File seems not to be an image.');
        } elseif (!in_array($fileMimeType, self::$allowedMimeTypes)) {
            throw new InvalidImageTypeException('Unsupported mime type: ' . $fileMimeType);
        }
    }
1324095
function validateFieldValue(fieldId, inputValue, valueIndex, sectionIndex, cb) {
      if ("function" === typeof valueIndex) {
        cb = valueIndex;
        valueIndex = 0;
        sectionIndex = 0;
      }

      if (_.isFunction(sectionIndex)) {
        cb = sectionIndex;
        sectionIndex = 0;
      }

      init();

      var fieldDefinition = fieldMap[fieldId];

      var required = false;
      if (fieldDefinition.repeating &&
          fieldDefinition.fieldOptions &&
          fieldDefinition.fieldOptions.definition &&
          fieldDefinition.fieldOptions.definition.minRepeat) {
        required = (valueIndex < fieldDefinition.fieldOptions.definition.minRepeat);
      } else {
        required = fieldDefinition.required;
      }

      var validation = (fieldDefinition.fieldOptions && fieldDefinition.fieldOptions.validation) ? fieldDefinition.fieldOptions.validation : undefined;

      if (validation && false === validation.validateImmediately) {
        var ret = {
          validation: {valid: true}
        };

        assignValidationResponse(fieldId, sectionIndex, ret.validation, {
          "valid": true
        });

        return cb(undefined, ret);
      }

      var requiredFieldEntry = requiredFieldMap[fieldDefinition._id] || {valueRequired: required};

      if (fieldEmpty(inputValue)) {
        if (required && requiredFieldEntry.valueRequired) {
          return formatResponse("No value specified for required input", cb);
        } else {
          return formatResponse(undefined, cb); // optional field not supplied is valid
        }
      }

      // not empty need to validate
      getClientValidatorFunction(fieldDefinition.type, function(err, validator) {
        if (err) {
          return cb(err);
        }

        validator(inputValue, fieldDefinition, undefined, function(err) {
          var message;
          if (err) {
            if (err.message) {
              message = err.message;
            } else {
              message = "Unknown error message";
            }
          }
          formatResponse(message, cb);
        });
      });

      function formatResponse(msg, cb) {
        var messages = {
          errorMessages: []
        };
        if (msg) {
          messages.errorMessages.push(msg);
        }
        return createValidatorResponse(fieldId, messages, sectionIndex, function(err, res) {
          if (err) {
            return cb(err);
          }
          var ret = {
            validation: {}
          };

          assignValidationResponse(fieldId, sectionIndex, ret.validation, res);

          return cb(undefined, ret);
        });
      }
    }
658314
function(formName) {
        var currentFieldsValidations,
            currentFieldsValue,
            currentValidationMethodAndParameters,
            i;

        this.currentForm = formName;
        this.errors = {};

        for (var fieldName in this.validationInformation[formName]) {
            this.currentField = fieldName;
            currentFieldsValidations = this.validationInformation[formName][fieldName];
            currentFieldsValue = this.utils.getFieldsValue(this.currentForm, this.currentField);

            for (i = 0; i < currentFieldsValidations.length; i++) {
                var method,
                    parameters = [];

                currentValidationMethodAndParameters = this.getValidationMethodAndParameters(currentFieldsValidations[i]);
                method = currentValidationMethodAndParameters[0];

                // Here we check to see if our parameters actually exist and if it does then store it.
                if (currentValidationMethodAndParameters.length === 2) {
                    parameters = currentValidationMethodAndParameters[1];
                }

                if (! this.callValidationMethodWithParameters(method, parameters, currentFieldsValue)) {
                    parameters.shift();
                    this.messages.addValidationErrorMessage(method, parameters);
                }
            }
        }

        // If there are no errors populated in the errors property then we passed.
        return this.utils.isEmptyObject(this.errors);
    }
901024
@Override
    public boolean isValid(Object input) {
        long epochMillisec;
        try {
            epochMillisec = Long.parseLong(input.toString());
        } catch (NumberFormatException e) {
            return false;
        }

        if (minValidTime != null && epochMillisec < minValidTime)
            return false;
        return !(maxValidTime != null && epochMillisec > maxValidTime);
    }
462977
function validate() {

    logger.logEnter('validate');

    for (var i = 0; i < buffer.length; i++) {

      var eventData = buffer[i],
        typeName = eventData[0],
        typeKeys = eventTypes[typeName];

      if (!typeKeys) {

        emitter.emit('error', typeName + ' is not a known event type.');

        // Remove these events.
        eventCount -= eventData.length - 1;
        buffer.splice(i, 1);
        i--;

      } else {

        for (var j = 1; j < eventData.length; j++) {

          if (!validEvent(Object.keys(eventData[j]), typeKeys, emitter, typeName)) {

            // Remove this event.
            eventCount--;
            if (eventData.length === 2) {
              buffer.splice(i, 1);
              i--;
              break;
            } else {
              eventData.splice(j, 1);
              j--;
            }
          }
        }
      }
    }

    logger.logExit('validate');
  }
407194
function validateInput(input, value) {

            var inputName = $(input).attr('name'),
                value = value || _getInputValue(input);

            if (!inputName) {

                // {debug}
                options.debug && window.Debug.log({
                    'node': node,
                    'function': 'validateInput()',
                    'arguments': '$(input).attr("name")',
                    'message': 'ERROR - Missing input [name]'
                });
                // {/debug}

                return false;
            }

            var matches = inputName.replace(/]$/, '').split(/]\[|[[\]]/g),
                inputShortName = window.Validation.labels[inputName] ||
                    options.labels[inputName] ||
                    $(input).attr(_data.label) ||
                    matches[matches.length - 1],

                validationArray = $(input).attr(_data.validation),
                validationMessage = $(input).attr(_data.validationMessage),
                validationRegex = $(input).attr(_data.regex),
                validationRegexReverse = !($(input).attr(_data.regexReverse) === undefined),
                validationRegexMessage = $(input).attr(_data.regexMessage),

                validateOnce = false;

            if (validationArray) {
                validationArray = _api._splitValidation(validationArray);
            }

            // Validates the "data-validation"
            if (validationArray instanceof Array && validationArray.length > 0) {

                // "OPTIONAL" input will not be validated if it's empty
                if ($.trim(value) === '' && ~validationArray.indexOf('OPTIONAL')) {
                    return true;
                }

                $.each(validationArray, function (i, rule) {

                    if (validateOnce === true) {
                        return true;
                    }

                    try {

                        validateRule(value, rule);

                    } catch (error) {

                        if (validationMessage || !options.submit.settings.allErrors) {
                            validateOnce = true;
                        }

                        error[0] = validationMessage || error[0];

                        registerError(inputName, error[0].replace('$', inputShortName).replace('%', error[1]));

                    }

                });

            }

            // Validates the "data-validation-regex"
            if (validationRegex) {

                var rule = _buildRegexFromString(validationRegex);

                // Do not block validation if a regexp is bad, only skip it
                if (!(rule instanceof RegExp)) {
                    return true;
                }

                try {

                    validateRule(value, rule, validationRegexReverse);

                } catch (error) {

                    error[0] = validationRegexMessage || error[0];

                    registerError(inputName, error[0].replace('$', inputShortName));

                }

            }

            return !errors[inputName] || errors[inputName] instanceof Array && errors[inputName].length === 0;

        }
673563
private void validate() {
        // a non-null values object is the flag we use to determine whether
        // to reparse from UIManager.
        if (values != null)
            return;

        // reconstruct this SeaGlassStyle based on the entries in the UIManager
        // and possibly based on any overrides within the component's
        // client properties (assuming such a component exists and contains
        // any SeaGlass.Overrides)
        values = new Values();

        // the profiler revealed that a great deal of CPU time and useless
        // garbage was being produced by this method and the init method. One
        // culprit was the creation and reparsing of the entire UIDefaults
        // map on each call to this method where "values" was null. It turns
        // out this was happening a lot.
        // To remove this bottleneck, we store the compiled TreeMaps of defaults
        // in the appContext for reuse. It is nulled whenever the UIDefaults
        // changes and recomputed when necessary.
        final AppContext ctx = AppContext.getAppContext();

        // fetch the defaults from the app context. If null, then create and
        // store the compiled defaults
        Map<String, TreeMap<String, Object>> compiledDefaults = (Map<String, TreeMap<String, Object>>) ctx.get("SeaGlassStyle.defaults");

        if (compiledDefaults == null) {

            // the entire UIDefaults tables are parsed and compiled into
            // this map of maps. The key of the compiledDefaults is the
            // prefix for each style, while the value is a map of
            // keys->values for that prefix.
            compiledDefaults = new HashMap<String, TreeMap<String, Object>>();

            // get all the defaults from UIManager.getDefaults() and put them
            // into the compiledDefaults
            compileDefaults(compiledDefaults, UIManager.getDefaults());

            // This second statement pulls defaults from the laf defaults
            UIDefaults lafDefaults = UIManager.getLookAndFeelDefaults();

            compileDefaults(compiledDefaults, lafDefaults);

            // if it has not already been done, add a listener to both
            // UIManager.getDefaults() and UIManager.getLookAndFeelDefaults().
            PropertyChangeListener pcl = (PropertyChangeListener) ctx.get("SeaGlassStyle.defaults.pcl");

            // if pcl is null, then it has not yet been registered with
            // the UIManager defaults for this app context
            if (pcl == null) {

                // create a PCL which will simply clear out the compiled
                // defaults from the app context, causing it to be recomputed
                // on subsequent passes
                pcl = new DefaultsListener();

                // add the PCL to both defaults tables that we pay attention
                // to, so that if the UIDefaults are updated, then the
                // precompiled defaults will be cleared from the app context
                // and recomputed on subsequent passes
                UIManager.getDefaults().addPropertyChangeListener(pcl);
                UIManager.getLookAndFeelDefaults().addPropertyChangeListener(pcl);

                // save the PCL to the app context as a marker indicating
                // that the PCL has been registered so we don't end up adding
                // more than one listener to the UIDefaults tables.
                ctx.put("SeaGlassStyle.defaults.pcl", pcl);
            }

            // store the defaults for reuse
            ctx.put("SeaGlassStyle.defaults", compiledDefaults);
        }

        TreeMap<String, Object> defaults = compiledDefaults.get(prefix);
        if (defaults == null) {
            defaults = new TreeMap<String, Object>();
        }

        // inspect the client properties for the key "SeaGlass.Overrides". If
        // the
        // value is an instance of UIDefaults, then these defaults are used
        // in place of, or in addition to, the defaults in UIManager.
        if (component != null) {
            Object o = component.getClientProperty("SeaGlass.Overrides");

            if (o instanceof UIDefaults) {
                Object                  i       = component.getClientProperty("SeaGlass.Overrides.InheritDefaults");
                boolean                 inherit = i instanceof Boolean ? (Boolean) i : true;
                UIDefaults              d       = (UIDefaults) o;
                TreeMap<String, Object> map     = new TreeMap<String, Object>();

                for (Object obj : d.keySet()) {

                    if (obj instanceof String) {
                        String key = (String) obj;

                        if (key.startsWith(prefix)) {
                            map.put(key, d.get(key));
                        }
                    }
                }

                if (inherit) {
                    defaults.putAll(map);
                } else {
                    defaults = map;
                }
            }
        }

        // Now that I've accumulated all the defaults pertaining to this
        // style, call init which will read these defaults and configure
        // the default "values".
        init(values, defaults);
    }
428840
function checkSync(validations, input, key) {
  var arr = new Checkit(validations).runSync(input);
  if (arr[0] === null) return arr;
  if (arr[0] instanceof CheckitError) {
    return [arr[0].get(key), null]
  }
  return arr;
}
477279
function (validations) {
		if (!validations) {
			return this;
		}

		if (!this.validations) {
			this.validations = [];
		}

		var that = this;

		_.isArray(validations) || (validations = [ validations ]);

		_.each(validations, function (validation) {
			that.validations.push(validation);
		});

		return this;
	}
999487
function CustomInput() {

        /**
         * ### CustomInput.input
         *
         * The HTML input element
         */
        this.input = null;

        /**
         * ### CustomInput.placeholder
         *
         * The placeholder text for the input form
         *
         * Some types preset it automatically
         */
        this.placeholder = null;

        /**
         * ### CustomInput.inputWidth
         *
         * The width of the input form as string (css attribute)
         *
         * Some types preset it automatically
         */
        this.inputWidth = null;

        /**
         * ### CustomInput.type
         *
         * The type of input
         */
        this.type = null;

        /**
         * ### CustomInput.preprocess
         *
         * The function that preprocess the input before validation
         *
         * The function receives the input form and must modify it directly
         */
        this.preprocess = null;

        /**
         * ### CustomInput.validation
         *
         * The validation function for the input
         *
         * The function returns an object like:
         *
         * ```javascript
         *  {
         *    value: 'validvalue',
         *    err:   'This error occurred' // If invalid.
         *  }
         * ```
         */
        this.validation = null;

        /**
         * ### CustomInput.validationSpeed
         *
         * How often (in milliseconds) the validation function is called
         *
         * Default: 500
         */
        this.validationSpeed = 500;

        /**
         * ### CustomInput.postprocess
         *
         * The function that postprocess the input after validation
         *
         * The function returns the postprocessed valued
         */
        this.postprocess = null;

        /**
         * ### CustomInput.params
         *
         * Object containing extra validation params
         *
         * This object is populated by the init function
         */
        this.params = {};

        /**
         * ### CustomInput.errorBox
         *
         * An HTML element displayed when a validation error occurs
         */
        this.errorBox = null;

        /**
         * ### CustomInput.mainText
         *
         * A text preceeding the custom input
         */
        this.mainText = null;

        /**
         * ### CustomInput.hint
         *
         * An additional text with information about the input
         *
         * If not specified, it may be auto-filled, e.g. '*'.
         *
         * @see CustomInput.texts.autoHint
         */
        this.hint = null;

        /**
         * ### CustomInput.requiredChoice
         *
         * If TRUE, the input form cannot be left empty
         *
         * Default: TRUE
         */
        this.requiredChoice = null;

        /**
         * ### CustomInput.timeBegin
         *
         * When the first character was inserted
         */
        this.timeBegin = null;

        /**
         * ### CustomInput.timeEnd
         *
         * When the last character was inserted
         */
        this.timeEnd = null;

        /**
         * ### CustomInput.checkbox
         *
         * A checkbox element for an additional action
         */
        this.checkbox = null;

        /**
         * ### CustomInput.checkboxText
         *
         * The text next to the checkbox
         */
        this.checkboxText = null;

        /**
         * ### CustomInput.checkboxCb
         *
         * The callback executed when the checkbox is clicked
         */
        this.checkboxCb = null;
    }
774575
@Override
  public void validate() {
    try {
      IFD ifd = model.getFirstIFD();
      int n = 0;
      while (ifd != null) {
        validateIfd(ifd, n);
        ifd = ifd.getNextIFD();
        n++;
      }
    } catch (Exception e) {

    }
  }
1180384
public void validate() {
        check("firstLine", this.firstLine);
        check("beforeEachLine", this.beforeEachLine);
        check("endLine", this.endLine);
        check("firstLineDetectionPattern", this.firstLineDetectionPattern);
        check("lastLineDetectionPattern", this.lastLineDetectionPattern);
        check("isMultiline", this.isMultiline);
        check("allowBlankLines", this.allowBlankLines);
        // skip line can be null
    }
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);
    }
237641
def validate_to_one(self, value):
        

        if value.rid and self.typeness is int:
            validators.validate_int(value)

        if value.rid and not self.skip_exists:
            if not value.load():
                raise ValidationError(self.messages['exists'])
        return value
890456
function () {
            this.errors = {};
            return flatten(this._static.validators.map(function runValidator(validator) {
                var col = validator.col, val = this.__values[validator.col], ret = validator.validate(val);
                this.errors[col] = ret;
                return ret;
            }, this));
        }
766891
function(attrName) {
    return function(err, validationErrMsg) {
      ranCount++
      if (returned) return

      // If error, return, and set `returned` to true.
      if (err) {
        returned = true
        return done(err)
      }

      // Add the validation error to the object `validationErrors`
      if (validationErrMsg) {
        self._merge(validationErrors, validationErrMsg, (prefix || '') + '.' + attrName)
        isValid = false
      }

      if (ranCount === attrNames.length) _runAfter()
    }
  }
1371080
@Override
    public boolean isValid(Object input) {
        Float d;
        try {
            d = (Float) input;
        } catch (Exception e) {
            return false;
        }

        if (allowNaN && Float.isNaN(d))
            return true;
        if (allowInfinite && Float.isInfinite(d))
            return true;

        if (minAllowedValue != null && d < minAllowedValue)
            return false;
        if (maxAllowedValue != null && d > maxAllowedValue)
            return false;

        return true;
    }