commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Néstor Boscán <nestor.bos...@tcs.com.ve>
Subject RE: BeanUtils setProperty IllegalArgumentException: Null property value for property
Date Mon, 17 Sep 2007 21:21:51 GMT
I don't see anywhere in the code that PropertyUtils access a Digester. In
the code it clearly shoes that it access an attribute, if it's null an
exception is thrown. It does not check or tries to instantiate the object.

Regards,

Néstor Boscán 

-----Mensaje original-----
De: jcarman@carmanconsulting.com [mailto:jcarman@carmanconsulting.com] En
nombre de James Carman
Enviado el: Lunes, 17 de Septiembre de 2007 03:25 p.m.
Para: Jakarta Commons Users List
Asunto: Re: BeanUtils setProperty IllegalArgumentException: Null property
value for property

Who said anything about Digester?

On 9/17/07, Madisetti, Sumesh <sumesh.madisetti@citi.com> wrote:
> Your digester rules files should be as follows -
>
> The following digester file will parse the content below and return you an
Address object with a City object inside it and the name of it set to NYC.
>
> <digester-rules>
>         <pattern value="address">
>                 <object-create-rule classname="Address"/>
>                 <pattern value="city">
>                         <object-create-rule classname="City"/>
>                         <bean-property-setter-rule pattern="name"
propertyname="name" />
>                         <set-next-rule methodname="addCity"/>
>                 </pattern>
>         </pattern>
> </digester-rules>
>
> Content-
> <address>
>         <city><name>NYC</name></city>
> </address>
>
>
> -----Original Message-----
> From: Néstor Boscán [mailto:nestor.boscan@tcs.com.ve]
> Sent: Friday, September 14, 2007 9:38 PM
> To: user@commons.apache.org
> Subject: BeanUtils setProperty IllegalArgumentException: Null property 
> value for property
>
> Hi
>
> I suppose that this has been asked and answered before but I can't find
the solution. I have some classes like this:
>
> public class Address {
>   private City city;
>
>   public City getCity () { return city; }
>
>   public void setCity (City city) { this.city = city; } }
>
> public class City {
>   private String name;
>
>   public String getName ( return name; }
>
>   public void setName (String name) { this.name = name; } }
>
> And I'm trying to set the city's name like this:
>
> PropertyUtils.setProperty (address, "city.name", "Toronto");
>
> And I'm getting IllegalArgumentException: Null property value for 'name'.
>
> Now I checked the 1.6 BeanUtils code and it doesn't instantiate the class
anywhere. Is this something that BeanUtils does?. If not does anybody knows
another technology that can do this?
>
> Regards,
>
> Néstor Boscán
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

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


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


Mime
View raw message