[jboss-user] [JBoss Seam] - Alternate property reference style in EL not working
pgmjsd
do-not-reply at jboss.com
Thu Apr 19 19:01:53 EDT 2007
It looks like http://jira.jboss.org/jira/browse/JBSEAM-580 has resurfaced.
I'm using Seam 1.2.1.GA and I get a String index out of bounds exception when I use the alternate syntax for referencing an entity property: #{entity[fieldName]}
Here is the stack trace:
18:57:39,147 ERROR [STDERR] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
| 18:57:39,148 ERROR [STDERR] at org.jboss.seam.ui.ModelValidator.validate(ModelValidator.java:32)
| 18:57:39,148 ERROR [STDERR] at javax.faces.component._ComponentUtils.callValidators(_ComponentUtils.java:157)
| 18:57:39,148 ERROR [STDERR] at javax.faces.component.UIInput.validateValue(UIInput.java:312)
| 18:57:39,148 ERROR [STDERR] at javax.faces.component.UIInput.validate(UIInput.java:353)
| ...
|
Basically, the following method in Expressions.java throws because 'dot' is -1:
| 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);
| }
|
Does anyone know of a way to work around this? I'm trying to make a generic Facelets tag for input fields and I can't because it won't let me bind to a property using this syntax.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4039091#4039091
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4039091
More information about the jboss-user
mailing list