/*
/////////////////////////////////////////////////////////
Internal methods, validation, exceptions
/////////////////////////////////////////////////////////
962427
private void _reportUndefinedNotationRefs()
        throws XMLStreamException
    {
        int count = mNotationForwardRefs.size();

        String id = mNotationForwardRefs.keySet().iterator().next();
        String msg = ""+count+" referenced notation"+((count == 1) ? "":"s")+" undefined: first one '"+id+"'";
        _reportVCViolation(msg);
    }
12198
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString id_validator = new MPSString();
		id_validator.setConstraintIsReq(MPSConstants.DELETE_CONSTRAINT, true);
		id_validator.validate(operationType, id, "\"id\"");
		
		MPSString uuid_validator = new MPSString();
		uuid_validator.setConstraintCharSetRegEx(MPSConstants.GENERIC_CONSTRAINT,"[ a-zA-Z0-9_#.:@=-]+");
		uuid_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		uuid_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		uuid_validator.validate(operationType, uuid, "\"uuid\"");
		
		MPSString name_validator = new MPSString();
		name_validator.setConstraintCharSetRegEx(MPSConstants.GENERIC_CONSTRAINT,"[ a-zA-Z0-9_#.:@=-]+");
		name_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		name_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		name_validator.validate(operationType, name, "\"name\"");
		
		MPSString description_validator = new MPSString();
		description_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 64);
		description_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		description_validator.validate(operationType, description, "\"description\"");
		
		MPSString type_validator = new MPSString();
		type_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 64);
		type_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		type_validator.validate(operationType, type, "\"type\"");
		
		MPSString device_family_validator = new MPSString();
		device_family_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 64);
		device_family_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		device_family_validator.validate(operationType, device_family, "\"device_family\"");
		
	}
345563
@FFDCIgnore(Exception.class) //manually logged or is NoSuchElementException which we want to ignore
    private void processInvalidListeners() {
        final boolean trace = com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled();

        String appName = getIStore().getId();

        long start = System.currentTimeMillis();

        if (trace && tc.isDebugEnabled())
            tcInvoke(tcSessionMetaCache, "iterator");

        @SuppressWarnings("rawtypes")
        Iterator<Cache.Entry<String, ArrayList>> it = sessionMetaCache.iterator();

        if (trace && tc.isDebugEnabled())
            tcReturn(tcSessionMetaCache, "iterator", it);

        while (it.hasNext()) {
            if (trace && tc.isDebugEnabled())
                tcInvoke(tcSessionMetaCache, "_iterator.next");

            @SuppressWarnings("rawtypes")
            Cache.Entry<String, ArrayList> entry;
            try {
                entry = it.next();
            } catch (NoSuchElementException x) {
                // ignore - some JCache providers might raise this instead of returning null when modified during iterator
                entry = null;
            }
            String id = entry == null ? null : entry.getKey();
            ArrayList<?> value = id == null ? null : entry.getValue();

            if (trace && tc.isDebugEnabled())
                tcReturn(tcSessionMetaCache, "_iterator.next", id, value);

            if (id != null && !INVAL_KEY.equals(id)) {
                SessionInfo sessionInfo = new SessionInfo(value);
                long lastAccess = sessionInfo.getLastAccess();
                short listenerTypes = sessionInfo.getListenerTypes();
                int maxInactive = sessionInfo.getMaxInactiveTime();
                if ((listenerTypes & BackedSession.HTTP_SESSION_BINDING_LISTENER) != 0 // sessions that DO have binding listeners
                                && maxInactive >= 0
                                && maxInactive < (start - lastAccess) / 1000) {

                    if (trace && tc.isDebugEnabled())
                        Tr.debug(this, tc, "processInvalidListeners for sessionID=" + id);

                    CacheSession session = new CacheSession(this, id, _iStore.getStoreCallback());
                    session.initSession(_iStore);
                    session.setIsValid(true);
                    session.setIsNew(false);
                    session.updateLastAccessTime(lastAccess);
                    session.setCreationTime(sessionInfo.getCreationTime());
                    session.internalSetMaxInactive(maxInactive);
                    session.internalSetUser(sessionInfo.getUser());
                    session.setListenerFlag(listenerTypes);

                    long now = System.currentTimeMillis();
                    //handle the subset of session listeners

                    lastAccess = session.getCurrentAccessTime(); // try using lastTouch again..

                    try {
                        // get the session ready and read in any listeners
                        session.setIsNew(false);
                        session.getSwappableListeners(BackedSession.HTTP_SESSION_BINDING_LISTENER);

                        sessionInfo = sessionInfo.clone();
                        sessionInfo.setLastAccess(lastAccess);

                        // only invalidate those which have not been accessed since
                        // check in computeInvalidList

                        ArrayList<Object> list = sessionInfo.getArrayList();

                        if (trace && tc.isDebugEnabled())
                            tcInvoke(tcSessionMetaCache, "remove", id, list);

                        boolean removed = sessionMetaCache.remove(id, list);

                        if (trace && tc.isDebugEnabled())
                            tcReturn(tcSessionMetaCache, "remove", removed);

                        if (removed) {
                            // return of session done as a result of this call
                            session.internalInvalidate(true);

                            Set<String> propIds = sessionInfo.getSessionPropertyIds();
                            if (propIds != null && !propIds.isEmpty()) {
                                HashSet<String> propKeys = new HashSet<String>();
                                for (String propId : propIds)
                                    propKeys.add(createSessionAttributeKey(id, propId));

                                if (trace && tc.isDebugEnabled())
                                    tcInvoke(tcSessionAttrCache, "removeAll", propKeys);

                                sessionAttributeCache.removeAll(propKeys);

                                if (trace && tc.isDebugEnabled())
                                    tcReturn(tcSessionAttrCache, "removeAll");
                            }
                        }

                        /*
                         * we don't want to update this on every invalidation with a listener that is processed.
                         * We'll only update this if we're getting close.
                         *
                         * Processing Invalidation Listeners could take a long time. We should update the
                         * NukerTimeStamp so that another server in this cluster doesn't kick off invalidation
                         * while we are still processing. We only want to update the time stamp if we are getting
                         * close to the time when it will expire. Therefore, we are going to do it after we're 1/2 way there.
                         */
                        if ((now + _smc.getInvalidationCheckInterval() * (1000 / 2)) < System.currentTimeMillis()) {
                            updateNukerTimeStamp(appName);
                            now = System.currentTimeMillis();
                        }
                    } catch (Exception e) {
                        FFDCFilter.processException(e, getClass().getName(), "652", this, new Object[] { session });
                        throw e;
                    }
                }
            }
        }
    }
708596
@JsonIgnore
    public void validate() throws OpsGenieClientValidationException {
        if (apiKey == null)
            throw OpsGenieClientValidationException.missingMandatoryProperty(OpsGenieClientConstants.API.API_KEY);
    }
44337
@FFDCIgnore(value = { SecurityException.class, IllegalAccessException.class, IllegalArgumentException.class, InvocationTargetException.class })
    private void callValidationMethod(String methodName, Object[] paramValues, Object theProvider) {
        if (theProvider == null) {
            return;
        }

        Method m = cxfBeanValidationProviderMethodsMap.get(methodName);

        if (m == null) {
            return;
        }

        try {
            m.invoke(theProvider, paramValues);
        } catch (SecurityException e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Can't access the method \"" + m.getName() + "\" due to security issue." + e.getMessage());
            }
        } catch (IllegalAccessException e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Can't access the method \"" + m.getName() + "\"." + e.getMessage());
            }
        } catch (IllegalArgumentException e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Illegal argument to the method \"" + m.getName() + "\"." + e.getMessage());
            }
        } catch (InvocationTargetException e) {

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Invocation of the method \"" + m.getName() + "\" fails" + e.getMessage());
            }

            /**
             * throw the javax.validation.ValidationException to keep the same behavior as CXF expected
             */
            Throwable validationException = e.getTargetException();
            if (null != validationException && validationException instanceof RuntimeException) {
                throw (RuntimeException) validationException;
            }

        }
    }
297360
@SuppressWarnings("unchecked")
	@Override
	protected void performValidation(String path, Object value, List<ValidationResult> results) {
		String name = path != null ? path : "value";
		value = ObjectReader.getValue(value);

		super.performValidation(path, value, results);

		if (value == null)
			return;

		if (value instanceof List<?>) {
			List<Object> list = (List<Object>) value;
			int index = 0;
			for (Object element : list) {
				String elementPath = path == null || path.length() == 0 ? Integer.toString(index) : path + "." + index;
				performTypeValidation(elementPath, _valueType, element, results);
				index++;
			}
		} else if (value.getClass().isArray()) {
			int length = Array.getLength(value);
			for (int index = 0; index < length; index++) {
				Object element = Array.get(value, index);
				String elementPath = path == null || path.length() == 0 ? Integer.toString(index) : path + "." + index;
				performTypeValidation(elementPath, _valueType, element, results);
				index++;
			}
		} else {
			results.add(new ValidationResult(path, ValidationResultType.Error, "VALUE_ISNOT_ARRAY",
					name + " type must be List or Array", "List", value.getClass()));
		}
	}
819923
@Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        List<String> emailAddresses = EmailAddressesParser.parse(value);
        List<String> badAddresses = null;
        for (String ea : emailAddresses) {
            if (!EMAIL_VALIDATOR.isValid(ea, null)) {
                if (badAddresses == null) {
                    badAddresses = new LinkedList<String>();
                }

                badAddresses.add(ea);
            }
        }

        if (badAddresses != null) {
            context.disableDefaultConstraintViolation();
            context.buildConstraintViolationWithTemplate(MessageFormat.format(constraintAnnotation.message(),
                                                                              StringUtils.join(badAddresses, ", ")))
                   .addConstraintViolation();
        }
        return (badAddresses == null);
    }
388104
public function validate() {

		if ($this->getRate() === null) {
			throw new ValidationException("'rate' can't be null", 'rate', $this);
		}
		if ($this->getTitle() === null) {
			throw new ValidationException("'title' can't be null", 'title', $this);
		}
	}
313969
@Override
    public void reportValidationProblem(XMLValidationProblem prob)
        throws XMLStreamException
    {
    	if (mVldProbHandler != null) {
            // Fix for [WSTX-209]
            mVldProbHandler.reportProblem(prob);
    	} else {
            super.reportValidationProblem(prob);
    	}
    }
983763
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString id_validator = new MPSString();
		id_validator.setConstraintIsReq(MPSConstants.DELETE_CONSTRAINT, true);
		id_validator.setConstraintIsReq(MPSConstants.MODIFY_CONSTRAINT, true);
		id_validator.validate(operationType, id, "\"id\"");
		
		MPSString server_name_validator = new MPSString();
		server_name_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		server_name_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		server_name_validator.setConstraintIsReq(MPSConstants.ADD_CONSTRAINT, true);
		server_name_validator.validate(operationType, server_name, "\"server_name\"");
		
		MPSString username_key_validator = new MPSString();
		username_key_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		username_key_validator.validate(operationType, username_key, "\"username_key\"");
		
		MPSString username_val_validator = new MPSString();
		username_val_validator.setConstraintCharSetRegEx(MPSConstants.GENERIC_CONSTRAINT,"[ a-zA-Z0-9_#.:@=-]+");
		username_val_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		username_val_validator.validate(operationType, username_val, "\"username_val\"");
		
		MPSString password_key_validator = new MPSString();
		password_key_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		password_key_validator.validate(operationType, password_key, "\"password_key\"");
		
		MPSString password_val_validator = new MPSString();
		password_val_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		password_val_validator.validate(operationType, password_val, "\"password_val\"");
		
		MPSString optional1_key_validator = new MPSString();
		optional1_key_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		optional1_key_validator.validate(operationType, optional1_key, "\"optional1_key\"");
		
		MPSString optional1_val_validator = new MPSString();
		optional1_val_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		optional1_val_validator.validate(operationType, optional1_val, "\"optional1_val\"");
		
		MPSString optional2_key_validator = new MPSString();
		optional2_key_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		optional2_key_validator.validate(operationType, optional2_key, "\"optional2_key\"");
		
		MPSString optional2_val1_validator = new MPSString();
		optional2_val1_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		optional2_val1_validator.validate(operationType, optional2_val1, "\"optional2_val1\"");
		
		MPSString optional3_key_validator = new MPSString();
		optional3_key_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		optional3_key_validator.validate(operationType, optional3_key, "\"optional3_key\"");
		
		MPSString optional3_val_validator = new MPSString();
		optional3_val_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		optional3_val_validator.validate(operationType, optional3_val, "\"optional3_val\"");
		
		MPSString base_url_validator = new MPSString();
		base_url_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 2000);
		base_url_validator.validate(operationType, base_url, "\"base_url\"");
		
		MPSString to_key_validator = new MPSString();
		to_key_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		to_key_validator.validate(operationType, to_key, "\"to_key\"");
		
		MPSString to_seperater_validator = new MPSString();
		to_seperater_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		to_seperater_validator.validate(operationType, to_seperater, "\"to_seperater\"");
		
		MPSString message_key_validator = new MPSString();
		message_key_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		message_key_validator.validate(operationType, message_key, "\"message_key\"");
		
		MPSString message_word_sperater_validator = new MPSString();
		message_word_sperater_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		message_word_sperater_validator.validate(operationType, message_word_sperater, "\"message_word_sperater\"");
		
		MPSString type_validator = new MPSString();
		type_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		type_validator.validate(operationType, type, "\"type\"");
		
		MPSBoolean is_ssl_validator = new MPSBoolean();
		is_ssl_validator.validate(operationType, is_ssl, "\"is_ssl\"");
		
	}
197755
@Override
    public void isValid() throws Exception {
        if (numStmnts() >= 2) {
            if (primaryJoinableHooks.size() > 0) {
                for (String joinField:primaryJoinableHooks) {
                    if (joinField.equals("timestamp")) {// timestamp is implicitly present in the result.
                        continue;
                    }
                    for (QueryMeta query: getAllStmnts()) {
                        boolean isPresent = false;
                        if (query instanceof BaseAggQueryMeta) {// Since BaseAggQueryMeta is also a PlainDimQueryMeta we go with former first.
                            for (AggItem item:((BaseAggQueryMeta)query).aggregations) {
                                if (joinField.equals(item.fieldName) || (item.asName != null && joinField.equals(item.asName))) {
                                    isPresent = true;
                                }
                            }
                        }
                        if (query instanceof PlainDimQueryMeta) {
                            Map<String, String> dims = ((PlainDimQueryMeta)query).fetchDimensions;
                            for (Map.Entry<String, String> entry :dims.entrySet()) {
                                if (joinField.equals(entry.getKey()) || (entry.getValue() != null && joinField.equals(entry.getValue()))) {
                                    isPresent = true;
                                }
                            }
                        }
                        if (!isPresent) {
                            String error = joinField + " mentioned in the composite key should appear in all the data sources being queried and joined.";
                            throw new Exception(error);
                        }
                    }
                }
            } else {
                String error = "Need atleast one field to join on";
                throw new Exception(error);
            }
        }
    }
367128
@Override
  public void validate(T arg) throws ValidationException {
    for (final Validator<T> validator : validators) {
      validator.validate(arg);
    }
  }
505860
function(validationParameters) {
        var i = 0,
            j = 0;

        // We need to loop through each of the "extra parameters" and furthur split the `parameters` if need be.
        for (; i < validationParameters.length; i++) {
            // Check to see if we have third level "parameters" that will be transformed into an array for specific
            // validation methods.  i.e:  not_in:foo,bar,baz.
            if (validationParameters[i].contains(",")) {
                validationParameters[i] = validationParameters[i].split(",");

                // Since there was third level "parameters" we will go ahead and loop through each of the elements and
                // trim away any whitespace and convert falsey or truthy values to their boolean representations.
                for (; j < validationParameters[i].length; j++) {
                    validationParameters[i][j] = this.utils.convertStringToBoolean(validationParameters[i][j].trim());
                }
            } else {
                // Trim any whitespace and convert falsy or truthy values to their boolean representations
                validationParameters[i] = this.utils.convertStringToBoolean(validationParameters[i].trim());
            }
        }

        return validationParameters;
    }
796251
public static void validateStringValue(String value) throws ParameterException {
		Validate.notNull(value);
		Validate.notEmpty(value);
	}
549402
public void checkValidity() throws ACMValidationException {
                if (context == null) {
                        throw new ACMValidationException("Invalid state of AC model: No context assigned");
                }
                if (!getContext().containsActivities()) {
                        return;
                }
                for (String activity : getContext().getActivities()) {
                        try {
                                if (!isExecutable(activity)) {
                                        throw new ACMValidationException("Model contains non-executable transactions: " + activity);
                                }
                        } catch (CompatibilityException e) {
                                throw new ACMValidationException("Error during validation check: " + e.getMessage());
                        }
                }
        }
170162
@Override
    public void validate() throws Exception {
        super.validate();
        this.parse();
        Assert.assertTrue("The upper date should be after the initial date",
                this.upper.after(this.lower));
    }
1367880
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString id_validator = new MPSString();
		id_validator.validate(operationType, id, "\"id\"");
		
		MPSString act_id_validator = new MPSString();
		act_id_validator.validate(operationType, act_id, "\"act_id\"");
		
		MPSString activity_validator = new MPSString();
		activity_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 128);
		activity_validator.validate(operationType, activity, "\"activity\"");
		
		MPSString status_validator = new MPSString();
		status_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 64);
		status_validator.validate(operationType, status, "\"status\"");
		
		MPSString message_validator = new MPSString();
		message_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 256);
		message_validator.validate(operationType, message, "\"message\"");
		
		MPSBoolean is_last_validator = new MPSBoolean();
		is_last_validator.validate(operationType, is_last, "\"is_last\"");
		
		MPSInt starttime_validator = new MPSInt();
		starttime_validator.validate(operationType, starttime, "\"starttime\"");
		
	}