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

Only one CDIValidator is invoked when defined via annotation @FacesValidator #4551

Closed
soul2zimate opened this issue Mar 19, 2019 · 1 comment
Assignees
Labels

Comments

@soul2zimate
Copy link
Contributor

https://github.com/eclipse-ee4j/mojarra/blob/2.3.9-RELEASE/impl/src/main/java/com/sun/faces/facelets/tag/jsf/ValidatorTagHandlerDelegateImpl.java#L123-L132 compares class name to skip found validator from existing validators list such as:

        for (Validator validator : validators) {
            if (validator.getClass().equals(v.getClass())) {
                found = true;
                break;
            }
        }
        
        if (!found) {
            evh.addValidator(v);
        }

However, if there are two CDIValidators, this only takes one instance into account.

When JSF CDI injection is enabled. InstanceFactory.createValidator calls CdiUtils.java to create new CDIValidators.

If JSF CDI injection is not enabled or configured by xml, createCDIValidator() returns null and InstanceFactory creates validator by keeping its Class type. Thus, it won't be skipped in above ValidatorTagHandlerDelegateImpl comparison.

        Validator<?> validator = createCDIValidator(validatorId);
        if (validator != null) {
            return validator;
        }

        validator = newThing(validatorId, validatorMap);
@github-actions
Copy link

This issue is marked as stale because there was no activity on it for the last 2 years. Remove stale label or comment or this will be closed in 30 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants