You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2002/11/23 14:34:34 UTC

DO NOT REPLY [Bug 14796] New: - ResultSetDynaClass.createDynaProperty uses getColumnName(i).toLowerCase()

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=14796>.
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=14796

ResultSetDynaClass.createDynaProperty uses getColumnName(i).toLowerCase()

           Summary: ResultSetDynaClass.createDynaProperty uses
                    getColumnName(i).toLowerCase()
           Product: Commons
           Version: 1.5 Final
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Bean Utilities
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: kenfitzpatrick@yahoo.com


ResultSetDynaClass.createDynaProperty uses getColumnName(i).toLowerCase(),
causing  a no-match condition for that version of the columnName when searching
for a PropertyDescriptor, later in PropertyUtils.copyProperties.

Conditions: 
ResultSet contains columnNames having mixed case letters.  
TargetBean has JavaBean-compliant property names.
TargetBean is not a DynaBean.
ResultSetDynaClass was created as in the example in the JavaDoc:
...ResultSetDynaClass rsdc = new ResultSetDynaClass( resultSet );
...
.....DynaBean oldRow = ( DynaBean ) rows.next();
.....Object newTargetBean = sampleTargetBeanClass.newInstance();
.....PropertyUtils.copyProperties( newTargetBean, oldRow );

Set-Up (cause of the problem):
ResultSetDynaClass.createDynaProperty 
line 328: String name = metadata.getColumnName(i).toLowerCase();
line 343: return new DynaProperty(name, clazz);

Call Stack at the point that the error appears:
PropertyUtils.copyProperties( newTargetBean, oldRow ), line 270
PropertyUtils.setSimpleProperty(bean, name, value), line 1642
PropertyUtils.getPropertyDescriptor(bean, name)

Solution code:
line 328: String name = metadata.getColumnName(i).toLowerCase();
line 343: return new DynaProperty(metadata.getColumnName(i), clazz);

Thanks!
Ken Fitzpatrick

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>