Package org.apache.sling.validation.api.exceptions

Examples of org.apache.sling.validation.api.exceptions.SlingValidationException


    public static final String REGEX_PARAM = "regex";

    @Override
    public String validate(String data, Map<String, String> arguments) {
        if (data == null || arguments == null) {
            throw new SlingValidationException("Cannot perform data validation with null parameters");
        }
        String regex = arguments.get(REGEX_PARAM);
        if (regex == null) {
            throw new SlingValidationException("Mandatory " + REGEX_PARAM + " is missing from the arguments map.");
        }
        Pattern pattern = Pattern.compile(regex);
        if (pattern.matcher(data).matches()) {
            return null;
        }
View Full Code Here


                    }
                    result.addFailureMessage(property, validatorMessage);
                }
            } catch (SlingValidationException e) {
                // wrap in another SlingValidationException to include information about the property
                throw new SlingValidationException("Could not call validator " + validator
                        .getClass().getName() + " for resourceProperty " + property, e);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.validation.api.exceptions.SlingValidationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.