[richfaces-issues] [JBoss JIRA] Created: (RF-7193) managed-property injection fail type cast on managed beans which extends generics

Zoltan Kiss (JIRA) jira-events at lists.jboss.org
Wed May 20 03:07:05 EDT 2009


managed-property injection fail type cast on managed beans which extends generics
---------------------------------------------------------------------------------

                 Key: RF-7193
                 URL: https://jira.jboss.org/jira/browse/RF-7193
             Project: RichFaces
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.0
         Environment: Win XP, Tomcat 6.0, JDK 5, Richfaces 3.3.0 GA
            Reporter: Zoltan Kiss


If I have a managed bean which extends a generic bean, than property injection from faces-config.xml doesn't sign error if I inject property with incompatible type.

Eg.:

public class MyGeneric<MYTYPE extends Serializable> {
    protected MYTYPE myProp;

    public void setMyProp(MYTYPE val) {
        this.myProp = val;
    }

    ....
}



public class MyBean extends MyGeneric<Long> {
    ....
}



    <managed-bean>
        <managed-bean-name>myBean</managed-bean-name>
        <managed-bean-class>MyBean</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
        <managed-property>
            <property-name>myProp</property-name>
            <value>#{param.myPropVal}</value>
        </managed-property>
    </managed-bean>


This example will inject the myPropVal request parameter (which is a String) into the myProp property of MyBean class which is a Long, and it won't throw ClassCastException. But later if I check the type of the property value it will be String - and probably it will fail my code somewhere else.

If MyBean doesn't extend from a generic class, but has its own, Long typed property, than I will have the ClassCastException during the injection.

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

        



More information about the richfaces-issues mailing list