dennis hoersch created MYFACES-3746:
---------------------------------------

             Summary: 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


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

Reply via email to