[jbossseam-issues] [JBoss JIRA] Closed: (JBSEAM-1836) Property name is not correctly retrieve - Instead of we got the index of the element !!!

Gavin King (JIRA) jira-events at lists.jboss.org
Tue Aug 21 22:10:18 EDT 2007


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

Gavin King closed JBSEAM-1836.
------------------------------

    Resolution: Rejected

This is expected and correct. A validation annotation on a String[] valued attribute would apply to the String[] array, not to the String array element.

> Property name is not correctly retrieve - Instead of we got the index of the element !!!
> ----------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-1836
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1836
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.1.GA
>         Environment:  Unix and Windows with RAD 7 (websphere) - JAVA 5.0 - JSF + JBoss Seam 1.2.1, facelet v1.1.12, Hibernate annotation 3.3.0
>            Reporter: Jorelia ANDRE
>         Attachments: validator-bugArray-2.PNG, validator-bugArray-3.PNG, validator-bugArray.PNG
>
>
> Hello Gavin,
> I've created a custom validator by using hibernate validator framework. So, I've put the new annotation on array of string (myString[] = new String[10]). Then I've used <s:validateAll> from JBoss Seam to validate the backing bean but unfortunately the isValid() method is never called. The reason is that the ClassValidator.java cannot retrieve properly the property name. Instead of, the property name is the index of the element !!!
> ClassValidor is called by the method from JBoss Core and JBoss ui
> ModelValidator -> ivs = Expressions.instance().validate( valueBinding.getExpressionString(), value ); -> InvalidValue[] validate(String propertyExpression, Object value)
> Here is the case sample:
> ====================
> The XHTML PAGE:
> -------------------------
> <!-- -->
> <!-- 10 PRODUCTS -->
> <!-- -->
>  <div class="colonneData">
>      <h:inputText id="numProduit1" value="#{myBean.product[0]}" />
>  </div>
>  <div class="colonneData">
>      <h:inputText id="numProduit1" value="#{myBean.product[1]}" />
>  </div>
>  <div class="colonneData">
>      <h:inputText id="numProduit1" value="#{myBean.product[2]}" />
>  </div>
>  etc.....
> The BEAN PAGE:
> -------------------------
> @Name("myBean")
> @Scope(CONVERSATION)
> @AutoCreate
> public class myBean extends ControleurPresentation {
>    @CheckProductNumber
>    private String[] product= new String[10];
> }
> The VALIDATOR
> -------------------------
> public class CheckProductNumberValidator implements Validator<CheckProductNumber> {
>    public boolean isValid(Object value) {
>     /* your validation code */
>       return true;
>   }
> }
> ERROR seems to come from this part of code that extract the property name. Instead of having the property name, we got the index of element. That means that the expression is not correctly parsed.
>       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);
> >>>>>>>>>>>>>>>>>>>>>>> HERE <<<<<<<<<<<<<<<<<<<<<<<<<<<<
>     // This part of code does not work for
>     //                 -  propertyExpression	"#{rechercheMaterielBean.produitsAutorises[0]}"	
>    //                  - value	"fsdfasdfasdfa"	
>    //                  - dot	23	
>     //                 - bracket	41	
>    //
>          propertyName = propertyExpression.substring( bracket+1, propertyExpression.length()-2 );
>    // We got "0".....!???
> >>>>>>>>>>>>>>>>>>>>>>> HERE <<<<<<<<<<<<<<<<<<<<<<<<<<<<
>       }
>  
> Could you please tell me if the new version resolves this bug ?
> Do you have a quick work around for that ?
> Thank you very much Gavin.
> Best regards,
> Jorelia.

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