You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2002/06/26 11:10:48 UTC
DO NOT REPLY [Bug 10239] New: -
Strange Bug in PropertyUtils, getter not found but exist in form class
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10239>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10239
Strange Bug in PropertyUtils, getter not found but exist in form class
Summary: Strange Bug in PropertyUtils, getter not found but exist
in form class
Product: Struts
Version: 1.0.2 Final
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Normal
Priority: Other
Component: Utilities
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: b7st@yahoo.fr
Hello,
On Struts 1.0.2, JDK 1.3.1, Tomcat 3.2, WIN 2000
I've got a strange bug on the PropertyUtils class, for tracking it, I add some
System.out in method public static Object getSimpleProperty(Object bean, String
name) from PropertyUtils class.
When I cast the bean with my class, the getter is found.
When I remove this cast, the getter is not found !
The datVers property is a nested property composed by 4 strings ( day, month,
year, date ), the toString method return nested property date
in my html tags I've got : datVers.day, datVers.month, datVers.year,
datVers.date
All the other form's property typed as DateField work fine. Only datVers crash.
-----------------------------
Code in PropertyUtils.class : WITH CAST IN FIRST System.out
public static Object getSimpleProperty(Object bean, String name) throws ... {
(...)
if ( name.equals("datVers") ) {
System.out.println
("((com.meeschaert.assurance.controller.form.CreatRachatAgForm)bean).getDatVers
()="+((com.meeschaert.assurance.controller.form.CreatRachatAgForm)
bean).getDatVers());
System.out.println("getSimpleProperty() bean=" + bean);
System.out.println("getSimpleProperty() name=" + name);
System.out.println("getSimpleProperty() descriptor=" + descriptor);
System.out.println("getSimpleProperty() descriptor.getName=" +
descriptor.getName());
System.out.println("getSimpleProperty() descriptor.getDisplayName=" +
descriptor.getDisplayName());
}
Method readMethod = getReadMethod(descriptor);
if (readMethod == null)
throw new NoSuchMethodException("Property '" + name +
"' has no getter method");
------------
System.out :
((com.meeschaert.assurance.controller.form.CreatRachatAgForm)bean).getDatVers()
=26/11/1991
getSimpleProperty()
bean=com.meeschaert.assurance.controller.form.CreatRachatAgForm@3411a
getSimpleProperty() name=datVers
getSimpleProperty() descriptor=java.beans.PropertyDescriptor@6df0f
getSimpleProperty() descriptor.getName=datVers
getSimpleProperty() descriptor.getDisplayName=datVers
getSimpleProperty() descriptor.getReadMethod=public
com.meeschaertx.controller.form.DateField
com.meeschaert.assurance.controller.form.CreatRachatAgForm.getDatVers()
-----------------------------
Code in PropertyUtils.class : WITHOUT CAST
public static Object getSimpleProperty(Object bean, String name) throws ... {
(...)
if ( name.equals("datVers") ) {
// COMMENT System.out.println
("((com.meeschaert.assurance.controller.form.CreatRachatAgForm)bean).getDatVers
()="+((com.meeschaert.assurance.controller.form.CreatRachatAgForm)
bean).getDatVers());
System.out.println("getSimpleProperty() bean=" + bean);
System.out.println("getSimpleProperty() name=" + name);
System.out.println("getSimpleProperty() descriptor=" + descriptor);
System.out.println("getSimpleProperty() descriptor.getName=" +
descriptor.getName());
System.out.println("getSimpleProperty() descriptor.getDisplayName=" +
descriptor.getDisplayName());
}
Method readMethod = getReadMethod(descriptor);
if (readMethod == null)
throw new NoSuchMethodException("Property '" + name +
"' has no getter method");
------------
System.out :
getSimpleProperty()
bean=com.meeschaert.assurance.controller.form.CreatRachatAgForm@52fc36
getSimpleProperty() name=datVers
getSimpleProperty() descriptor=java.beans.PropertyDescriptor@25fefa
getSimpleProperty() descriptor.getName=datVers
getSimpleProperty() descriptor.getDisplayName=datVers
getSimpleProperty() descriptor.getReadMethod=null
NoSuchMethodException=com.meeschaert.assurance.controller.form.CreatRachatAgForm
@52fc36#datVers.date=26/11/1991
javax.servlet.jsp.JspException: No getter method for property datVers.date of
bean org.apache.struts.taglib.html.BEAN
at org.apache.struts.util.RequestUtils.lookup(Unknown Source)
-Emmanuel
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>