You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Wendy Smoak <ja...@wendysmoak.com> on 2005/01/26 00:18:32 UTC

[beanutils] Problem with indexed properties

Someone on struts-user got tripped up by what I thought was a bean that
didn't conform to the spec, but then I learned that for an indexed property,
you can have four accessors, such as:
    String[] getProp()
    String getProp( int )
    void setProp( String[] )
    void setProp( int, String )

The struts user threads are:
     http://marc.theaimsgroup.com/?t=110644250000001&r=1&w=2
     http://marc.theaimsgroup.com/?t=110666379700006&r=1&w=2

I can reproduce the 'argument type mismatch' error under both Windows and
HP-UX, with JDK 1.4.2 or 1.5.0, with this code:

BeanUtilsBean beanUtilsBean = new BeanUtilsBean(
                                new ConvertUtilsBean(),
                                new PropertyUtilsBean());
IndexedBean bean = new IndexedBean();
String[] newValue = new String[] { "dog", "cat", "bird" };
beanUtilsBean.setProperty(bean, "prop", newValue );

(IndexedBean just has the four methods shown above.)

test.bean:
     [echo] Running BeanUtils tests ...
     [java] [ERROR] PropertyUtils - Method invocation failed.
<java.lang.IllegalArgumentException: argument type
mismatch>java.lang.IllegalArgumentException: argument type mismatch

The additional test and bean are attached to bug 28358.
http://issues.apache.org/bugzilla/show_bug.cgi?id=28358

It was originally reported as a JVM problem, but even if the code would work
under 1.3.1, that isn't going to help those of us who have long since moved
up to 1.4 and 1.5.

-- 
Wendy Smoak


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org