You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Konstantin Priblouda <kp...@yahoo.com> on 2005/10/17 18:17:19 UTC
[BeanUtils] Strange behaviour when setting array property.
Hi all,
when I try to set array property frm string in form
"1,2,3,4,5" ( which should be possible if I read
docs on ConvertUtils / IntegerArrayConverter )
it sets just first element, and uses just
IntegerConverter:
---------------%<--------------------------
DEBUG:
setProperty(de.kesselweb.mydiablo.data.beans.skill.Skill@1e59128,
levmindamArray, {1, 2, 3, 4, 5}) (org.apache.commons
.beanutils.BeanUtils)
DEBUG: Convert String[1] to class 'int[]'
(org.apache.commons.beanutils.ConvertUtils)
DEBUG: Using converter
org.apache.commons.beanutils.converters.IntegerConverter@73a34b
(org.apache.commons.beanutils.ConvertU
tils)
DEBUG: setSimpleProperty: Invoking method public void
de.kesselweb.mydiablo.data.beans.skill.Skill.setLevmindamArray(int[])
wit
h value [I@c24c0 (class [I)
(org.apache.commons.beanutils.PropertyUtils)
DEBUG: Convert string '1' to class 'int'
(org.apache.commons.beanutils.ConvertUtils)
---------------%<--------------------------
Which is kind of incorrect...
I believe Problem is in
BeanUtilsBean.setProperty(Object bean, String name,
Object value) which treats this situation as attemt
to set indexed property without correct index, and
chooses scalar converter instead... ( around lines
991-1015 )
regards,
----[ Konstantin Pribluda http://www.pribluda.de ]----------------
Still using XDoclet 1.x? XDoclet 2 is released and of production quality.
check it out: http://xdoclet.codehaus.org
__________________________________
Yahoo! Music Unlimited
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org