You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Mark Kettner <ma...@fredhopper.com> on 2002/04/25 13:00:35 UTC

Bug when reading a mapped property from an HTML form + fix

I got a NullPointer when struts tried to read a HTML form with mapped
attributes

<html:text property="attributeValue(manuf_product_url)" size="20" />

The problem existed in 'BeanUtils.java' (+/- line 630):

        if (type.isArray() && (index < 0)) { // Scalar value into array

where type was null for a MappedPropertyDescriptor. I've added the
following code and now everything works fine:

            if (descriptor instanceof IndexedPropertyDescriptor) {
                type = ((IndexedPropertyDescriptor) descriptor).
                    getIndexedPropertyType();
+           } else if (descriptor instanceof MappedPropertyDescriptor) {
+            	type = ((MappedPropertyDescriptor) descriptor).
+            		getMappedPropertyType();
            } else {
                type = descriptor.getPropertyType();
            }


Can this be checked in in the code, or did I miss something?

Mark

-- 
--o-o----------
Mark Kettner
http://www.fredhopper.com
Amsterdam, The Netherlands
Phone:  +31 20 3206203 Mobile: +31 620 609 817
fax:    +31 20 8848747
E-mail: mark@fredhopper.com, m.a.kettner@chello.nl



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