You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by robert burrell donkin <ro...@blueyonder.co.uk> on 2004/05/20 23:49:57 UTC

[beanutils] Re: Indexed Array properties (that is, Indexes of Arrays)

hi david

(please prefix posts about beanutils with [beanutils])

the way you tell it, it sounds like a bug. maybe i'll think of a reason 
why it was coded that way when i see the patch. craig's really busy 
right now which is a shame since the area of 'is this a feature?' is 
best dealt with by him. maybe i'll talk to the folks on struts dev if 
i'm not sure...

rather than just contributing the patch, please contribute (in 
addition) a good set of test cases which illustrate the (possible) bug.

- robert

On 20 May 2004, at 22:05, David Wood wrote:

> What are people's feelings about supporting indexed properties with 
> Array
> value types?
>
> What I'd like to do is allow
>
> public String[] getIndexedArrayProperty(int index)
> public void setIndexedArrayProperty(int index,String newvalue[])
>
> Currently, this will fail with an IllegalArgumentException in
> PropertyUtilsBean, because setProperty will decide to store the first
> element of the newvalue array rather than the whole array. And in
> BeanUtils there is a getIndexedProperty and a getArrayProperty but no
> getIndexedArrayProperty. Is this for a particular reason? Or would it 
> be
> appropriate to add the capability?
>
> To give a bit more background, this is actually something I've been 
> doing
> already with an "earlier" version of BeanUtils, and now I want to 
> upgrade
> to the current commons version without (immediately) giving it up.
>
> I found myself needing to do this to store various Struts "multibox"
> results (String[]) in an indexed property. This technique came from an
> application written against Struts 1.0, using the old
> struts.util.BeanUtils class. And this actually worked fine there - 
> minus a
> typo-bug in the code (in populate). I have a 1-line patch that fixes 
> it,
> and that's what I've been using.
>
> Now it's time to go to Struts 1.1, and a similar "fix" to commons
> BeanUtils might be useful for others, so I thought, lets see what 
> everyone
> thinks? Esoteric, I know, but is there anything actually wrong with
> supporting indexed properties with an Array value type?
>
> Regards,
> David
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>


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


Re: [beanutils] Re: Indexed Array properties (that is, Indexes of Arrays)

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
thanks. we need to cut a beanutils release very soon so i'll try to 
look at this very soon.

- robert

On 25 May 2004, at 15:02, David Wood wrote:

> Well, it feels like a bug. But I don't really know this project that 
> well,
> and I don't want to assume anything about the goals/rules/aesthetic of
> BeanUtils.
>
> I've opened a bug on this (Bug #29203), and attached a patch against 
> the
> HEAD, which is 1 line of fix, and the rest modifications to TestBean 
> and
> test cases.
>
> Regards,
> David
>
> robert burrell donkin <ro...@blueyonder.co.uk> wrote on
> 05/20/2004 05:49:57 PM:
>
>> hi david
>>
>> (please prefix posts about beanutils with [beanutils])
>>
>> the way you tell it, it sounds like a bug. maybe i'll think of a 
>> reason
>> why it was coded that way when i see the patch. craig's really busy
>> right now which is a shame since the area of 'is this a feature?' is
>> best dealt with by him. maybe i'll talk to the folks on struts dev if
>> i'm not sure...
>>
>> rather than just contributing the patch, please contribute (in
>> addition) a good set of test cases which illustrate the (possible) 
>> bug.
>>
>> - robert
>>
>> On 20 May 2004, at 22:05, David Wood wrote:
>>
>>> What are people's feelings about supporting indexed properties with
>>> Array
>>> value types?
>>>
>>> What I'd like to do is allow
>>>
>>> public String[] getIndexedArrayProperty(int index)
>>> public void setIndexedArrayProperty(int index,String newvalue[])
>>>
>>> Currently, this will fail with an IllegalArgumentException in
>>> PropertyUtilsBean, because setProperty will decide to store the first
>>> element of the newvalue array rather than the whole array. And in
>>> BeanUtils there is a getIndexedProperty and a getArrayProperty but no
>>> getIndexedArrayProperty. Is this for a particular reason? Or would it
>>> be
>>> appropriate to add the capability?
>>>
>>> To give a bit more background, this is actually something I've been
>>> doing
>>> already with an "earlier" version of BeanUtils, and now I want to
>>> upgrade
>>> to the current commons version without (immediately) giving it up.
>>>
>>> I found myself needing to do this to store various Struts "multibox"
>>> results (String[]) in an indexed property. This technique came from 
>>> an
>>> application written against Struts 1.0, using the old
>>> struts.util.BeanUtils class. And this actually worked fine there -
>>> minus a
>>> typo-bug in the code (in populate). I have a 1-line patch that fixes
>>> it,
>>> and that's what I've been using.
>>>
>>> Now it's time to go to Struts 1.1, and a similar "fix" to commons
>>> BeanUtils might be useful for others, so I thought, lets see what
>>> everyone
>>> thinks? Esoteric, I know, but is there anything actually wrong with
>>> supporting indexed properties with an Array value type?
>>>
>>> Regards,
>>> David
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>


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


Re: [beanutils] Re: Indexed Array properties (that is, Indexes of Arrays)

Posted by David Wood <Da...@thestreet.com>.
Well, it feels like a bug. But I don't really know this project that well, 
and I don't want to assume anything about the goals/rules/aesthetic of 
BeanUtils. 

I've opened a bug on this (Bug #29203), and attached a patch against the 
HEAD, which is 1 line of fix, and the rest modifications to TestBean and 
test cases.

Regards,
David

robert burrell donkin <ro...@blueyonder.co.uk> wrote on 
05/20/2004 05:49:57 PM:

> hi david
> 
> (please prefix posts about beanutils with [beanutils])
> 
> the way you tell it, it sounds like a bug. maybe i'll think of a reason 
> why it was coded that way when i see the patch. craig's really busy 
> right now which is a shame since the area of 'is this a feature?' is 
> best dealt with by him. maybe i'll talk to the folks on struts dev if 
> i'm not sure...
> 
> rather than just contributing the patch, please contribute (in 
> addition) a good set of test cases which illustrate the (possible) bug.
> 
> - robert
> 
> On 20 May 2004, at 22:05, David Wood wrote:
> 
> > What are people's feelings about supporting indexed properties with 
> > Array
> > value types?
> >
> > What I'd like to do is allow
> >
> > public String[] getIndexedArrayProperty(int index)
> > public void setIndexedArrayProperty(int index,String newvalue[])
> >
> > Currently, this will fail with an IllegalArgumentException in
> > PropertyUtilsBean, because setProperty will decide to store the first
> > element of the newvalue array rather than the whole array. And in
> > BeanUtils there is a getIndexedProperty and a getArrayProperty but no
> > getIndexedArrayProperty. Is this for a particular reason? Or would it 
> > be
> > appropriate to add the capability?
> >
> > To give a bit more background, this is actually something I've been 
> > doing
> > already with an "earlier" version of BeanUtils, and now I want to 
> > upgrade
> > to the current commons version without (immediately) giving it up.
> >
> > I found myself needing to do this to store various Struts "multibox"
> > results (String[]) in an indexed property. This technique came from an
> > application written against Struts 1.0, using the old
> > struts.util.BeanUtils class. And this actually worked fine there - 
> > minus a
> > typo-bug in the code (in populate). I have a 1-line patch that fixes 
> > it,
> > and that's what I've been using.
> >
> > Now it's time to go to Struts 1.1, and a similar "fix" to commons
> > BeanUtils might be useful for others, so I thought, lets see what 
> > everyone
> > thinks? Esoteric, I know, but is there anything actually wrong with
> > supporting indexed properties with an Array value type?
> >
> > Regards,
> > David
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 


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