[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2335) Page Parameters: incorrect validation code in org.jboss.seam.navigation.Pages

Wolfgang Schwendt (JIRA) jira-events at lists.jboss.org
Sun Dec 2 15:06:06 EST 2007


Page Parameters: incorrect validation code in org.jboss.seam.navigation.Pages
-----------------------------------------------------------------------------

                 Key: JBSEAM-2335
                 URL: http://jira.jboss.com/jira/browse/JBSEAM-2335
             Project: JBoss Seam
          Issue Type: Bug
          Components: Core
         Environment: CVS based Seam 2.0.1
            Reporter: Wolfgang Schwendt


Conversion and Validation of Page Parameters is initiated by org.jboss.seam.navigation.Pages.convertAndValidateStringValuesInPageContext(FacesContext facesContext)

In that method, the conversion and validation of a page parameter is done in the wrong order.

The code is currently as follows and does first the validation and afterwards the conversion.    It passes the unconverted (!) String value of the page parameter to method pageParameter.validateConvertedValue(facesContext, value).


// org.jboss.seam.navigation.Pages.convertAndValidateStringValuesInPageContext()

               String value = (String) Contexts.getPageContext().get( pageParameter.getName() );
               if (value!=null)
               {
                  pageParameter.validateConvertedValue(facesContext, value);
                  Object convertedValue = pageParameter.convertValueFromString(facesContext, value);
                  Contexts.getEventContext().set( pageParameter.getName(), convertedValue );
               }
         


It would be the correct approach, however,  to do first the conversion, and afterwards the validation of the converted value.



// org.jboss.seam.navigation.Pages.convertAndValidateStringValuesInPageContext()

String value = (String) Contexts.getPageContext().get( pageParameter.getName() );
               if (value!=null)
               {
                  Object convertedValue = pageParameter.convertValueFromString(facesContext, value);

                  pageParameter.validateConvertedValue(facesContext, convertedValue);
                  Contexts.getEventContext().set( pageParameter.getName(), convertedValue );
               }
	



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list