You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2010/05/04 22:57:02 UTC

[jira] Created: (MYFACES-2697) BeanValidation class is annotated with @FacesVallidator tag

BeanValidation class is annotated with @FacesVallidator tag
-----------------------------------------------------------

                 Key: MYFACES-2697
                 URL: https://issues.apache.org/jira/browse/MYFACES-2697
             Project: MyFaces Core
          Issue Type: Bug
          Components: JSR-314
    Affects Versions: 2.0.0
            Reporter: Leonardo Uribe


BeanValidation class is annotated with @FacesVallidator annotation, and it should not be.

We know that by default BeanValidation should be added to the Application object only if the param javax.faces.validator.DISABLE_DEFAULT_BEAN_VALIDATOR is set to false. So, there is no reason to use @FacesValidator, let the scanner find it and then check the property. It is better keep things simple and simplify the code on FacesConfigurator.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (MYFACES-2697) BeanValidation class is annotated with @FacesValidator tag

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2697?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Korherr resolved MYFACES-2697.
------------------------------------

    Fix Version/s: 2.0.1-SNAPSHOT
       Resolution: Fixed

> BeanValidation class is annotated with @FacesValidator tag
> ----------------------------------------------------------
>
>                 Key: MYFACES-2697
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2697
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Leonardo Uribe
>            Assignee: Jakob Korherr
>             Fix For: 2.0.1-SNAPSHOT
>
>
> BeanValidation class is annotated with @FacesVallidator annotation, and it should not be.
> We know that by default BeanValidation should be added to the Application object only if the param javax.faces.validator.DISABLE_DEFAULT_BEAN_VALIDATOR is set to false. So, there is no reason to use @FacesValidator, let the scanner find it and then check the property. It is better keep things simple and simplify the code on FacesConfigurator.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2697) BeanValidation class is annotated with @FacesValidator tag

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12864000#action_12864000 ] 

Jakob Korherr commented on MYFACES-2697:
----------------------------------------

I'm afraid the last commit (with revision 941039) breaks the functionality committed in MYFACES-2514. However it has to be verified which one is right.

> BeanValidation class is annotated with @FacesValidator tag
> ----------------------------------------------------------
>
>                 Key: MYFACES-2697
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2697
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Leonardo Uribe
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.1-SNAPSHOT
>
>
> BeanValidation class is annotated with @FacesVallidator annotation, and it should not be.
> We know that by default BeanValidation should be added to the Application object only if the param javax.faces.validator.DISABLE_DEFAULT_BEAN_VALIDATOR is set to false. So, there is no reason to use @FacesValidator, let the scanner find it and then check the property. It is better keep things simple and simplify the code on FacesConfigurator.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (MYFACES-2697) BeanValidation class is annotated with @FacesValidator tag

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2697?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe reopened MYFACES-2697:
-------------------------------------

      Assignee: Jakob Korherr  (was: Leonardo Uribe)

Ok, I reverted the change, but now it is registered from src/main/conf/META-INF/standard-faces-config-base.xml, so I'm happy with that.

But checking the spec javadoc something is not right. See jsf 2.0 spec section 3.5.3 For example:

"....Any configuration resource that declares a list of default validators overrides any list provided in a previously processed
configuration resource. If an empty <default-validators/> element is found in a configuration resource, the list
of default validators must be cleared...."

But the code in DigesterFacesConfigDispenserImpl do this:

defaultValidatorIds.addAll (application.getDefaultValidatorIds());

There is no check for that condition. We are not saving the difference between no <default-validators/> and empty <default-validators/>.

Now, this paragraph is not clear:

"....The runtime must guarantee that the validator id javax.faces.Bean is included in the result from a call to
Application.getDefaultValidatorInfo() (see Section 7.1.11.1 "Default Validator Ids"), regardless of any
configuration found in the application configuration resources or via the @FacesValidator annotation..."

That means, no matter what happen with defaultValidatorIds, javax.faces.Bean should be included. If defaultValidatorIds is empty, but javax.faces.validator.DISABLE_DEFAULT_BEAN_VALIDATOR is false, javax.faces.Bean should be included.

Jakob, could you take a look at this one?

> BeanValidation class is annotated with @FacesValidator tag
> ----------------------------------------------------------
>
>                 Key: MYFACES-2697
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2697
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Leonardo Uribe
>            Assignee: Jakob Korherr
>             Fix For: 2.0.1-SNAPSHOT
>
>
> BeanValidation class is annotated with @FacesVallidator annotation, and it should not be.
> We know that by default BeanValidation should be added to the Application object only if the param javax.faces.validator.DISABLE_DEFAULT_BEAN_VALIDATOR is set to false. So, there is no reason to use @FacesValidator, let the scanner find it and then check the property. It is better keep things simple and simplify the code on FacesConfigurator.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2697) BeanValidation class is annotated with @FacesValidator tag

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12864015#action_12864015 ] 

Jakob Korherr commented on MYFACES-2697:
----------------------------------------

...and why did you remove the installation of the DebugPhaseListener with the latest commit (revision 941050)? :(

> BeanValidation class is annotated with @FacesValidator tag
> ----------------------------------------------------------
>
>                 Key: MYFACES-2697
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2697
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Leonardo Uribe
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.1-SNAPSHOT
>
>
> BeanValidation class is annotated with @FacesVallidator annotation, and it should not be.
> We know that by default BeanValidation should be added to the Application object only if the param javax.faces.validator.DISABLE_DEFAULT_BEAN_VALIDATOR is set to false. So, there is no reason to use @FacesValidator, let the scanner find it and then check the property. It is better keep things simple and simplify the code on FacesConfigurator.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2697) BeanValidation class is annotated with @FacesValidator tag

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12864050#action_12864050 ] 

Leonardo Uribe commented on MYFACES-2697:
-----------------------------------------

I commented the previous solution and committed what I think it is the correct interpretation of the spec. 

I think the config param just takes precedence over empty <default-validators/>. Why? because do the opposite means in some conditions the param just will not work and it will not be clear for the user. Also, the documentation of the param does not mention that side effect:

"....If this param is defined, and calling toLowerCase().equals("true") on a String representation of its value returns true, the runtime must not automatically add the validator with validator-id equal to the value of the symbolic constant VALIDATOR_ID  to the list of default validators. Setting this parameter to true will have the effect of disabling the automatic installation of Bean Validation to every input component in every view in the application, though manual installation is still possible....."

> BeanValidation class is annotated with @FacesValidator tag
> ----------------------------------------------------------
>
>                 Key: MYFACES-2697
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2697
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Leonardo Uribe
>            Assignee: Jakob Korherr
>             Fix For: 2.0.1-SNAPSHOT
>
>
> BeanValidation class is annotated with @FacesVallidator annotation, and it should not be.
> We know that by default BeanValidation should be added to the Application object only if the param javax.faces.validator.DISABLE_DEFAULT_BEAN_VALIDATOR is set to false. So, there is no reason to use @FacesValidator, let the scanner find it and then check the property. It is better keep things simple and simplify the code on FacesConfigurator.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2697) BeanValidation class is annotated with @FacesValidator tag

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12869706#action_12869706 ] 

Jakob Korherr commented on MYFACES-2697:
----------------------------------------

I cleaned up the code on FacesConfigurator, FacesConfigDispenser and DigesterFacesConfigDispenserImpl. Furthermore I removed the installation of the BeanValidator as a default-validator from standard-faces-config-base.xml, because this can only happend programmatically (we have to check if bean validation is available), and added a comment there.

I also added a check for two special scenarios on FacesConfigurator, which will result in log messages to inform the user, because they may lead to problems:
    1) the BeanValidator was disabled as a default-validator via DISABLE_DEFAULT_BEAN_VALIDATOR, but a faces-config file adds it, which is totally ok by the spec
    2) a faces-config file added the BeanValidator but bean validation is not available in the classpath, thus it will not work

These two scenarios could be hard to trace, because there can be lots of config files when using some frameworks, thus I thought it would be a good idea to inform the user.

In addition I added a lot of test cases on FacesConfiguratorDefaultValidatorsTestCase which check nearly every possible configuration scenario.

So this issue can now be resolved :)

> BeanValidation class is annotated with @FacesValidator tag
> ----------------------------------------------------------
>
>                 Key: MYFACES-2697
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2697
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Leonardo Uribe
>            Assignee: Jakob Korherr
>
> BeanValidation class is annotated with @FacesVallidator annotation, and it should not be.
> We know that by default BeanValidation should be added to the Application object only if the param javax.faces.validator.DISABLE_DEFAULT_BEAN_VALIDATOR is set to false. So, there is no reason to use @FacesValidator, let the scanner find it and then check the property. It is better keep things simple and simplify the code on FacesConfigurator.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (MYFACES-2697) BeanValidation class is annotated with @FacesValidator tag

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2697?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe resolved MYFACES-2697.
-------------------------------------

         Assignee: Leonardo Uribe
    Fix Version/s: 2.0.1-SNAPSHOT
       Resolution: Fixed

> BeanValidation class is annotated with @FacesValidator tag
> ----------------------------------------------------------
>
>                 Key: MYFACES-2697
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2697
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Leonardo Uribe
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.1-SNAPSHOT
>
>
> BeanValidation class is annotated with @FacesVallidator annotation, and it should not be.
> We know that by default BeanValidation should be added to the Application object only if the param javax.faces.validator.DISABLE_DEFAULT_BEAN_VALIDATOR is set to false. So, there is no reason to use @FacesValidator, let the scanner find it and then check the property. It is better keep things simple and simplify the code on FacesConfigurator.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2697) BeanValidation class is annotated with @FacesValidator tag

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12869123#action_12869123 ] 

Jakob Korherr commented on MYFACES-2697:
----------------------------------------

I will check this again (also against Mojarra) and add some test cases to verify the behavior!

> BeanValidation class is annotated with @FacesValidator tag
> ----------------------------------------------------------
>
>                 Key: MYFACES-2697
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2697
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Leonardo Uribe
>            Assignee: Jakob Korherr
>
> BeanValidation class is annotated with @FacesVallidator annotation, and it should not be.
> We know that by default BeanValidation should be added to the Application object only if the param javax.faces.validator.DISABLE_DEFAULT_BEAN_VALIDATOR is set to false. So, there is no reason to use @FacesValidator, let the scanner find it and then check the property. It is better keep things simple and simplify the code on FacesConfigurator.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.