wrapper method that wraps input validation and logging around the perform_validation method.
 Do not override or use this class in child classes. This is the class that gets called
 on validator objects.
769643
def validate(challenge_password, certname, raw_csr)
      @log.debug "running validate"
      fail unless challenge_password.is_a?(String)
      fail unless certname.is_a?(String)

      case perform_validation(challenge_password, certname, raw_csr)
      when true
        @log.debug "validated successfully"
        @log.info  "Validated '#{certname}' using '#{name}' validator"
        return true
      when false
        @log.debug "validation failed"
        @log.debug "Unable to validate '#{certname}' using '#{name}' validator"
        return false
      else
        @log.error "perform_validation returned a non-boolean result"
        raise "perform_validation returned a non-boolean result"
      end
    end
864257
def validate!
      errors.clear

      # Run the before_validate callbacks
      run_callbacks(:before_validate).then do
        # Run the actual validations
        run_validations
      end.then do
        # See if any server errors are in place and merge them in if they are
        errors.merge!(server_errors.to_h) if Volt.client?
      end.then do
        run_custom_validations
      end.then do
        # Return the errors object
        errors
      end
    end
771561
def Msg(validator, message):
    
    @wraps(Msg)
    def built(value):
        try:
            return validator(value)
        except Error as e:
            e.message = message
            raise e
    return built
1160199
protected void performInvalidation() {
        if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[PERFORM_INVALIDATION]);
        }

        long now = System.currentTimeMillis();
        PreparedStatement ps1 = null;
        ResultSet rs1 = null;
        PreparedStatement ps2 = null;

        boolean ps1Closed = false;
        boolean ps2Closed = false;

        Connection nukerCon = null;

        // do some initializations
        String appName = getIStore().getId(); //bhSessionContext.getAppName();

        boolean doInvals = false;
        boolean doDatabaseInval = doScheduledInvalidation();
        nukerCon = getConnection(false);

        if (nukerCon == null) {
            if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
                LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[PERFORM_INVALIDATION], "Connection is null");
            }
            return;
        }

        try {

            // handle last acc times for manual update irregardless
            // of whether this thread will scan for time outs
            if (!_smc.getEnableEOSWrite()) {
                writeCachedLastAccessedTimes(nukerCon);
            }

            //check the value of doDatabaseInval
            if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE,methodClassName, methodNames[PERFORM_INVALIDATION], "doDatabaseInval="+doDatabaseInval);
            }

            if (doDatabaseInval) {
                ps1 = nukerCon.prepareStatement(readLastAccess);
                ps1.setString(1, appName);
                ps1.setString(2, appName);
                ps1.setString(3, appName);
                rs1 = ps1.executeQuery();

                boolean rowExists = false;
                long lastTime = 0L;
                if (rs1.next()) {
                    rowExists = true;
                    lastTime = rs1.getLong(1);
                }
                rs1.close();
                ps1.close();
                ps1Closed = true;

                //check the value of rowExists
                if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE,methodClassName, methodNames[PERFORM_INVALIDATION], "rowExists="+rowExists);
                }

                if (rowExists) {
                    long lastCheck = now - _smc.getInvalidationCheckInterval() * 1000;

                    //check the value of lastCheck,lastTime,now
                    if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                        LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE,methodClassName, methodNames[PERFORM_INVALIDATION], "lastCheck="+lastCheck+",lastTime="+lastTime+",now="+now);
                    }

                    //if no other server tried to process invalidation within the interval, this will be true
                    //similar to updateNukerTimeStamp, but we have an extra check here to test the last access time hasn't changed
                    //PK30585 - added future time check
                    if ((lastCheck >= lastTime) || (lastTime > now)) {
                        ps2 = nukerCon.prepareStatement(optUpdate);
                        setPSLong(ps2, 1, now);
                        ps2.setString(2, appName);
                        ps2.setString(3, appName);
                        ps2.setString(4, appName);
                        setPSLong(ps2, 5, lastTime);
                        int res = ps2.executeUpdate();
                        if (res > 0)
                            doInvals = true;
                    }
                } else {
                    //If we are here means, this is the first time this web module is
                    //trying to invalidation of sessions
                    ps2 = nukerCon.prepareStatement(insForInval);
                    ps2.setString(1, appName);
                    ps2.setString(2, appName);
                    ps2.setString(3, appName);
                    setPSLong(ps2, 4, now);
                    ps2.setInt(5, -1);
                    try {
                        ps2.executeUpdate();
                        doInvals = true;
                    } catch (SQLException sqle) {
                        //                        if (isDuplicateKeyException(sqle)) {
                        //                            // ignore duplicate key errror here - can only happen in very small timing window but causes no harm
                        //                            if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                        //                                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[PERFORM_INVALIDATION], "Duplicate key inserted");
                        //                            }
                        //                        } else {
                        throw sqle; // to be re-caught and logged below
                        //                        }
                    }
                }

                if (ps2 != null)
                    ps2.close();
                ps2Closed = true;

                //check the value of doInvals
                if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE,methodClassName, methodNames[PERFORM_INVALIDATION], "doInvals="+doInvals);
                }

                if (doInvals) {

                    //Process the non-listener sessions first
                    doInvalidations(nukerCon);

                    //Read in all the sessions with listeners that need to be invalidated
                    Enumeration e = pollForInvalidSessionsWithListeners(nukerCon);
                    processInvalidListeners(e, nukerCon);

                }

            }

        } catch (Throwable t) {
            com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.session.store.db.DatabaseHashMap.performInvalidation", "2537", this);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[PERFORM_INVALIDATION], "DatabaseHashMap.performInvalidationError");
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[PERFORM_INVALIDATION], "CommonMessage.exception", t);
        } finally {
            if (!ps1Closed && rs1 != null)
                closeResultSet(rs1);
            if (!ps1Closed && ps1 != null)
                closeStatement(ps1);
            if (!ps2Closed && ps2 != null)
                closeStatement(ps2);
            closeConnection(nukerCon);
        }
        if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
            LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[PERFORM_INVALIDATION]);
        }
    }
1129267
def validate(cls, mapper_spec):
    
    if mapper_spec.input_reader_class() != cls:
      raise BadReaderParamsError("Input reader class mismatch")
    params = _get_params(mapper_spec)
    if cls.BATCH_SIZE_PARAM in params:
      try:
        batch_size = int(params[cls.BATCH_SIZE_PARAM])
        if batch_size < 1:
          raise BadReaderParamsError("Bad batch size: %s" % batch_size)
      except ValueError, e:
        raise BadReaderParamsError("Bad batch size: %s" % e)
239320
def handler_for(rjr_method)
    # look for exact match first
    handler = @handlers.find { |k,v| k == rjr_method }

    # if not found try to match regex's
    handler ||= @handlers.find { |k,v| k.is_a?(Regexp) && (k =~ rjr_method) }

    handler.nil? ? nil : handler.last
  end
663746
def run_validator(value)
      return unless validator
      error = validator.call(value)
      raise ValidationError unless error.nil?
    end
980076
def _register_bounds_validator_if_needed(parser, name, flag_values):
  
  if parser.lower_bound is not None or parser.upper_bound is not None:

    def checker(value):
      if value is not None and parser.is_outside_bounds(value):
        message = '%s is not %s' % (value, parser.syntactic_help)
        raise _exceptions.ValidationError(message)
      return True

    _validators.register_validator(name, checker, flag_values=flag_values)
1149295
def _check_known_decorators(typ, calling_decorator  # type: str
                            ):
    # type: (...) -> bool
    
    for member in typ.__dict__.values():
        if hasattr(member, '__enforcer__'):
            raise AutoclassDecorationException('It seems that @runtime_validation decorator was applied to type <'
                                               + str(typ) + '> BEFORE ' + calling_decorator + '. This is not supported '
                                               'as it may lead to counter-intuitive behaviour, please change the order '
                                               'of the decorators on <' + str(typ) + '>')
679168
def validate(self, data):
        
        for v in self.validators:
            v(self, data)
        return data
787489
def validate_wrap(self, value):
        '''  '''
        if not isinstance(value, basestring):
            self._fail_validation_type(value, basestring)
        if self.max is not None and len(value) > self.max:
            self._fail_validation(value, 'Value too long (%d)' % len(value))
        if self.min is not None and len(value) < self.min:
            self._fail_validation(value, 'Value too short (%d)' % len(value))
394170
def run_validations(validations = nil)
      # Default to running the class level validations
      validations ||= self.class.validations_to_run

      promise = Promise.new.resolve(nil)
      if validations

        # Run through each validation
        validations.each_pair do |field_name, options|
          promise = promise.then { run_validation(field_name, options) }
        end
      end

      promise
    end
1202142
def _get_input_validator(self, request):
        

        method = request.method.upper()
        if method != 'POST':
            return self.representation
        elif self.post_representation:
            return self.post_representation
        else:
            return self.representation
1187479
def regex_validation_sealer(fields, defaults, RegexType=type(re.compile(""))):
    
    required = set(fields) - set(defaults)
    if required:
        raise TypeError(
            "regex_validation_sealer doesn't support required arguments. Fields that need fixing: %s" % required)

    klass = None
    kwarg_validators = dict(
        (key, val if isinstance(val, RegexType) else re.compile(val)) for key, val in defaults.items()
    )
    arg_validators = list(
        kwarg_validators[key] for key in fields
    )

    def __init__(self, *args, **kwargs):
        for pos, (value, validator) in enumerate(zip(args, arg_validators)):
            if not validator.match(value):
                raise ValidationError("Positional argument %s failed validation. %r doesn't match regex %r" % (
                    pos, value, validator.pattern
                ))
        for key, value in kwargs.items():
            if key in kwarg_validators:
                validator = kwarg_validators[key]
                if not validator.match(value):
                    raise ValidationError("Keyword argument %r failed validation. %r doesn't match regex %r" % (
                        key, value, validator.pattern
                    ))
        super(klass, self).__init__(*args, **kwargs)

    klass = type("RegexValidateBase", (__base__,), dict(
        __init__=__init__,
    ))
    return klass
1017375
def validate(self, *args, **kwargs): # pylint: disable=arguments-differ
        
        return super(ParameterValidator, self)._validate(*args, **kwargs)
960193
def perform
      job = payload_class
      job_args = args || []
      job_was_performed = false

      begin
        # Execute before_perform hook. Abort the job gracefully if
        # Resque::DontPerform is raised.
        begin
          before_hooks.each do |hook|
            job.send(hook, *job_args)
          end
        rescue DontPerform
          return false
        end

        # Execute the job. Do it in an around_perform hook if available.
        if around_hooks.empty?
          job.perform(*job_args)
          job_was_performed = true
        else
          # We want to nest all around_perform plugins, with the last one
          # finally calling perform
          stack = around_hooks.reverse.inject(nil) do |last_hook, hook|
            if last_hook
              lambda do
                job.send(hook, *job_args) { last_hook.call }
              end
            else
              lambda do
                job.send(hook, *job_args) do
                  result = job.perform(*job_args)
                  job_was_performed = true
                  result
                end
              end
            end
          end
          stack.call
        end

        # Execute after_perform hook
        after_hooks.each do |hook|
          job.send(hook, *job_args)
        end

        # Return true if the job was performed
        return job_was_performed

      # If an exception occurs during the job execution, look for an
      # on_failure hook then re-raise.
      rescue Object => e
        run_failure_hooks(e)
        raise e
      end
    end
167587
def any_validator(obj, validators, **kwargs):
    
    if not len(validators) > 1:
        raise ValueError(
            "any_validator requires at least 2 validator.  Only got "
            "{0}".format(len(validators))
        )
    errors = ErrorDict()
    for key, validator in validators.items():
        try:
            validator(obj, **kwargs)
        except ValidationError as err:
            errors[key] = err.detail
        else:
            break
    else:
        if len(errors) == 1:
            # Special case for a single error.  Just raise it as if it was the
            # only validator run.
            error = errors.values()[0]
            raise ValidationError(error)
        else:
            # Raise all of the errors with the key namespaces.
            errors.raise_()