[jbossseam-issues] [JBoss JIRA] Closed: (JBSEAM-1214) Alternate EL property reference #{entity[fieldName]} doesn't work

Pete Muir (JIRA) jira-events at lists.jboss.org
Thu Jun 21 05:28:52 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBSEAM-1214?page=all ]

Pete Muir closed JBSEAM-1214.
-----------------------------


> Alternate EL property reference #{entity[fieldName]} doesn't work
> -----------------------------------------------------------------
>
>                 Key: JBSEAM-1214
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1214
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.1.GA
>            Reporter: Joshua Davis
>         Assigned To: Pete Muir
>            Priority: Minor
>             Fix For: 1.3.0.ALPHA
>
>
> Validation fails for inputText fields where the value expression is of the form: #{entity[fieldName]}
> The problem is in Expressions.java, in the validate() method:
> {code}
>    public InvalidValue[] validate(String propertyExpression, Object value)
>    {
>       int dot = propertyExpression.lastIndexOf('.');
>       int bracket = propertyExpression.lastIndexOf('[');
>       if (dot<=0 && bracket<=0) 
>       {
>          return new InvalidValue[0];
>       }
>       String componentName;
>       String propertyName;
>       if (dot>bracket)
>       {
>          componentName = propertyExpression.substring(2, dot);
>          propertyName = propertyExpression.substring( dot+1, propertyExpression.length()-1 );
>       }
>       else
>       {
>          componentName = propertyExpression.substring(2, bracket);
>          propertyName = propertyExpression.substring( bracket+1, propertyExpression.length()-2 );
>       }
>       String modelExpression = propertyExpression.substring(0, dot) + '}';
>       
>       Object modelInstance = createValueBinding(modelExpression).getValue(); //TODO: cache the ValueBinding object!
>       return getValidator(modelInstance, componentName).getPotentialInvalidValues(propertyName, value);
>    }
> {code}
> This line is the problem:
>       String modelExpression = propertyExpression.substring(0, dot) + '}';
> if a dot is not found, 'dot' is -1... boom!

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