Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException in regex pattern validation if no SchemaValidatorsConfig is passed #280

Closed
foldvari opened this issue Apr 1, 2020 · 1 comment

Comments

@foldvari
Copy link

foldvari commented Apr 1, 2020

It is possible to load a schema without a SchemaValidatorsConfig but in this case the validation of the schema itself will fail at regex pattern validation.

Location of the exception:

compileRegexPattern(pattern, validationContext.getConfig().isEcma262Validator());

public PatternValidator(String schemaPath, JsonNode schemaNode, JsonSchema parentSchema, ValidationContext validationContext) {

        super(schemaPath, schemaNode, parentSchema, ValidatorTypeCode.PATTERN, validationContext);
        pattern = "";
        if (schemaNode != null && schemaNode.isTextual()) {
            pattern = schemaNode.textValue();
            try {
                compileRegexPattern(pattern, validationContext.getConfig().isEcma262Validator());
            } catch (PatternSyntaxException pse) {
                logger.error("Failed to compile pattern : Invalid syntax [" + pattern + "]", pse);
                throw pse;
            } catch (SyntaxException se) {
                logger.error("Failed to compile pattern : Invalid syntax [" + pattern + "]", se);
                throw se;
            }
        }


@waizuwolf
Copy link
Contributor

@stevehu: Please close this issue.

@stevehu stevehu closed this as completed Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants