In looking over the current release notes for the BeanUtils in the commons
project, I can across the following bug report list:

BUG REPORTS ADDRESSED:
=====================

4895 Populate method doesn't work for an indexed setter for arrays
6125 Populate method has mistaken the judgement which uses indexed
     property
6465 Wrong method BeanUtils.populate(), so that in Struts indexed
     multiselects not work





"Jerome Jacobsen" <[EMAIL PROTECTED]> on 05/30/2002 01:55:54
PM

Please respond to "Struts Users Mailing List"
      <[EMAIL PROTECTED]>

To:   "Struts Users Mailing List" <[EMAIL PROTECTED]>
cc:    (bcc: Kevin Bedell/Systems/USHO/SunLife)
Subject:  RE: BeanUtils


I'm also having trouble concerning indexed properties with BeanUtils.  If
the type of the indexed property is String, then BeanUtils.populate throws
IllegalArgumentException.

Using your NameBean in an example:

...
     NameBean nameBean = new NameBean();
     BeanUtils.populate(nameBean,new String[] {"John", "Paul", "Jack"});

     // above throws IllegalArgumentException!
...


If I take the same indexed property and change it to an int
BeanUtils.populate works!

I've posted this problem to both the jakarta-commons-dev and struts-user
lists with no response.  So I don't know if it is supported or not.
Please,
can someone give us an answer???

-----Original Message-----
From: Filipe Mateus [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 30, 2002 1:30 PM
To: [EMAIL PROTECTED]
Subject: BeanUtils


Do BeanUtils.describe and BeanUtils.populate supposed to handle indexed
properties?

Suppose I have this JavaBean:

public class NameBean {
     private String[] name;

     public String[] getName() {
          return this.name;
     }
     public void setName(String[] name) {
          this.name = name;
     }
     public String getName(int index) {
          return this.name[index];
     }
     public void setName(int index, String name) {
          this.name[index] = name;
     }
}

I would expect the following code to return a Map containing:
name[0]="John", name[1]="Paul", name[2]="Jack"
but instead, I get name="John".
Only the first element is considered.

...
     NameBean nameBean = new NameBean();
     nameBean.setName(new String[] {"John", "Paul", "Jack"});

     Map properties = BeanUtils.describe(nameBean);
...


**********************************************************************
Financiere Banque Nationale et NBCN n'assument
aucune responsabilite quant a la confidentialite et l'integrite du
present courriel en raison des risques d'interception inherents
a l'Internet. Pour cette raison, toute opinion exprimee au terme
des presentes ne reflete pas necessairement celle de
Financiere Banque Nationale et de NBCN.
**********************************************************************
Due to the security risks involved in sending information over the
Internet, National Bank Financial  and NBCN cannot be held responsible
for ensuring the confidentiality and integrity of the present e-mail. For
this
reason, the opinions expressed herein do not necessarily reflect those of
National Bank Financial and NBCN.
**********************************************************************


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>




--
To unsubscribe, e-mail:   <
mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>







---------------------------------------------------------------------------
This e-mail message (including attachments, if any) is intended for the use
of the individual or entity to which it is addressed and may contain
information that is privileged, proprietary , confidential and exempt from
disclosure.  If you are not the intended recipient, you are notified that
any dissemination, distribution or copying of this communication is
strictly prohibited.  If you have received this communication in error,
please notify the sender and erase this e-mail message immediately.
---------------------------------------------------------------------------


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to