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

Joshua Davis (JIRA) jira-events at lists.jboss.org
Thu Apr 19 20:25:30 EDT 2007

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
            Reporter: Joshua Davis
             Fix For: 1.2.1.GA

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:
   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 );
         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);

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