You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by fl...@tin.it on 2003/08/25 12:40:18 UTC
[BeanUtils] How to set a mapped property when the key contains dots?
hi all,
i'm using BeanUtils.setProperty() inside my application. When property is
mapped and the key contains dots, beanutils thinks the key has nested
properties (which is non-sense to me). Is there a way to escape dots? Why
beanutils tries to access nested properties in a String-based key? Is this a
bug?
example:
environment(java.naming.factory.initial)
btw: the app is called XFP
http://xfp.sourceforge.net
--
() ascii ribbon campaign - against html mail
/\ - against microsoft attachments
Re: [BeanUtils] How to set a mapped property when the key contains
dots?
Posted by Flavio Tordini <fl...@tin.it>.
It works! Thank you so much, robert!
flavio
robert burrell donkin wrote:
> hi Flavio
>
> there are a couple of problems with the example. on is a bug with
> beanutils (which i've hopefully fixed now) and the other is that the
> mapped set property on your example bean is shielded by the standard
> property with the same name.
>
> it needs to be something like:
>
> getMappedProperty(String key)
> setMappedProperty(String key, Object value)
>
> once you make this change an upgrade to the next nightly, i hope that
> everything will work.
>
> - robert
>
> On Tuesday, August 26, 2003, at 10:33 AM, Flavio Tordini wrote:
>
>> i tried with the most recent nightly build, to no avail. i'm attaching
>> a small
>> class that demonstrates the bug. hope this helps!
>>
>> flavio
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
Re: [BeanUtils] How to set a mapped property when the key contains dots?
Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
hi Flavio
there are a couple of problems with the example. on is a bug with
beanutils (which i've hopefully fixed now) and the other is that the
mapped set property on your example bean is shielded by the standard
property with the same name.
it needs to be something like:
getMappedProperty(String key)
setMappedProperty(String key, Object value)
once you make this change an upgrade to the next nightly, i hope that
everything will work.
- robert
On Tuesday, August 26, 2003, at 10:33 AM, Flavio Tordini wrote:
> i tried with the most recent nightly build, to no avail. i'm attaching a
> small
> class that demonstrates the bug. hope this helps!
>
> flavio
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [BeanUtils] How to set a mapped property when the key contains dots?
Posted by Flavio Tordini <ft...@tiscali.com>.
i tried with the most recent nightly build, to no avail. i'm attaching a small
class that demonstrates the bug. hope this helps!
flavio
Re: [BeanUtils] How to set a mapped property when the key contains dots?
Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
hi
this does look like a a similar issue to #10478.
could try again with a build from CVS HEAD or a recent nightly?
if this is still an issue, then could you please supply a unit test that
demonstrates this bug which you are willing to donate to the ASF.
- robert
On Monday, August 25, 2003, at 02:52 PM, flaviotordini@tin.it wrote:
> sorry i forgot to include a stacktrace. here it is:
>
> java.lang.IllegalArgumentException: Invalid mapped property 'environment(
> java'
> at
> org.apache.commons.beanutils.PropertyUtils.getMappedProperty
> (PropertyUtils.java:546)
> at
> org.apache.commons.beanutils.PropertyUtils.getNestedProperty
> (PropertyUtils.java:730)
> at
> org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:
> 783)
> at
> org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:793)
>
>
> is this bug the same of bugzilla #10478??? (that bug is marked as
> RESOLVED...)
>
> flavio
>
> On Monday 25 August 2003 12:40, flaviotordini@tin.it wrote:
>> hi all,
>> i'm using BeanUtils.setProperty() inside my application. When property is
>> mapped and the key contains dots, beanutils thinks the key has nested
>> properties (which is non-sense to me). Is there a way to escape dots? Why
>> beanutils tries to access nested properties in a String-based key? Is
>> this
>> a bug?
>>
>> example:
>> environment(java.naming.factory.initial)
>>
>> btw: the app is called XFP
>> http://xfp.sourceforge.net
>
> --
> () ascii ribbon campaign - against html mail
> /\ - against microsoft attachments
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
Re: [BeanUtils] How to set a mapped property when the key contains dots?
Posted by fl...@tin.it.
sorry i forgot to include a stacktrace. here it is:
java.lang.IllegalArgumentException: Invalid mapped property 'environment(java'
at
org.apache.commons.beanutils.PropertyUtils.getMappedProperty(PropertyUtils.java:546)
at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:730)
at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:783)
at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:793)
is this bug the same of bugzilla #10478??? (that bug is marked as RESOLVED...)
flavio
On Monday 25 August 2003 12:40, flaviotordini@tin.it wrote:
> hi all,
> i'm using BeanUtils.setProperty() inside my application. When property is
> mapped and the key contains dots, beanutils thinks the key has nested
> properties (which is non-sense to me). Is there a way to escape dots? Why
> beanutils tries to access nested properties in a String-based key? Is this
> a bug?
>
> example:
> environment(java.naming.factory.initial)
>
> btw: the app is called XFP
> http://xfp.sourceforge.net
--
() ascii ribbon campaign - against html mail
/\ - against microsoft attachments