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 2013/09/15 02:30:52 UTC

[jira] [Resolved] (MYFACES-3746) Cache resolved value of javax.faces.VALIDATE_EMPTY_FIELDS

     [ https://issues.apache.org/jira/browse/MYFACES-3746?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe resolved MYFACES-3746.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.13
                   2.0.19
         Assignee: Leonardo Uribe

Thanks to Dennis Hoersch for provide this patch
                
> Cache resolved value of javax.faces.VALIDATE_EMPTY_FIELDS
> ---------------------------------------------------------
>
>                 Key: MYFACES-3746
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3746
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 2.1.12
>            Reporter: dennis hoersch
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.19, 2.1.13
>
>
> In UIInput.shouldInterpretEmptyStringSubmittedValuesAsNull() the resolved value of 'javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL' is cached in the application map. It might be worth doing the same for 'javax.faces.VALIDATE_EMPTY_FIELDS' in UIInput.shouldValidateEmptyFields():
> private boolean shouldValidateEmptyFields(FacesContext context)
> {
>     ExternalContext ec = context.getExternalContext();
>     Boolean validateEmptyFields = (Boolean) ec.getApplicationMap()
>                                                                      .get(VALIDATE_EMPTY_FIELDS_PARAM_NAME);
>    
>     if (validateEmptyFields == null)
>     {
>          String param = ec.getInitParameter(VALIDATE_EMPTY_FIELDS_PARAM_NAME);
>          
>          // null means the same as auto.
>          if (param == null)
>          {
>              param = "auto";
>          }
>          else
>          {
>              // The environment variables are case insensitive.
>              param = param.toLowerCase();
>          }
>          
>          if (param.equals("auto") && _ExternalSpecifications.isBeanValidationAvailable())
>          {
>              validateEmptyFields = true;
>          }
>          else if (param.equals("true"))
>          {
>              validateEmptyFields = true;
>          } else {
>              validateEmptyFields = false;
>          }
>          
>          // cache the parsed value
>          ec.getApplicationMap().put(VALIDATE_EMPTY_FIELDS_PARAM_NAME, validateEmptyFields);
>     }
>     return validateEmptyFields;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira