You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Tolley Shorn <Sh...@nrm.qld.gov.au> on 2003/05/09 03:53:37 UTC

[beanutils] problem with PropertyUtils.getNestedProperty(Object, name) throwing too many IllegalArgumentExceptions

Hi folks,

Please let me know if I should be posting this message to a different place.

I have a problem with the PropertyUtils.getNestedProperty(Object, name) method.

It documents that it throws an IllegalArgumentException "if a nested reference to a property returns null".
Which is great, because I want to actually trap that exact situation and deal with it explicitly.
Unfortunately, the method throws IllegalArgumentException  for a number of other situations.  Also, because it's a runtime exception I have to assume that exception could be thrown from anywhere in the call stack.

Is there another way to do what I want to do without deplicating the code of the getNestedProperty() method?

Currently, I'm building my own beanutils jar, and having the getNestedProperty() method throw an explicitly created subclass of InvocationTargetException (NullNestedReferenceException) that I can catch in my calling code.

I'd like to use an official build of beanutils though (rather than my own one).
If there's not a better way to do what I want, how do I go about requesting that this functionality be added to CVS (possibly with my own patch if the developers find it acceptable)?

Thanks,
Shorn Tolley.






************************************************************************
The information in this e-mail together with any attachments is
intended only for the person or entity to which it is addressed
and may contain confidential and/or privileged material.

Any form of review, disclosure, modification, distribution
and/or publication of this e-mail message is prohibited.  

If you have received this message in error, you are asked to
inform the sender as quickly as possible and delete this message
and any copies of this message from your computer and/or your
computer system network.  
************************************************************************


Re: [beanutils] problem with PropertyUtils.getNestedProperty(Object, name) throwing too many IllegalArgumentExceptions

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
hi

i've added a new NestedNullException to beanutils which (i hope) should 
solve your problem. you'll need to wait for a new nightly build or build 
from CVS HEAD in order to use this feature.

- robert

On Friday, May 9, 2003, at 02:53 AM, Tolley Shorn wrote:

> Hi folks,
>
> Please let me know if I should be posting this message to a different 
> place.
>
> I have a problem with the PropertyUtils.getNestedProperty(Object, name) 
> method.
>
> It documents that it throws an IllegalArgumentException "if a nested 
> reference to a property returns null".
> Which is great, because I want to actually trap that exact situation and 
> deal with it explicitly.
> Unfortunately, the method throws IllegalArgumentException  for a number 
> of other situations.  Also, because it's a runtime exception I have to 
> assume that exception could be thrown from anywhere in the call stack.
>
> Is there another way to do what I want to do without deplicating the code 
> of the getNestedProperty() method?
>
> Currently, I'm building my own beanutils jar, and having the 
> getNestedProperty() method throw an explicitly created subclass of 
> InvocationTargetException (NullNestedReferenceException) that I can catch 
> in my calling code.
>
> I'd like to use an official build of beanutils though (rather than my own 
> one).
> If there's not a better way to do what I want, how do I go about 
> requesting that this functionality be added to CVS (possibly with my own 
> patch if the developers find it acceptable)?
>
> Thanks,
> Shorn Tolley.
>
>
>
>
>
>
> ************************************************************************
> The information in this e-mail together with any attachments is
> intended only for the person or entity to which it is addressed
> and may contain confidential and/or privileged material.
>
> Any form of review, disclosure, modification, distribution
> and/or publication of this e-mail message is prohibited.
>
> If you have received this message in error, you are asked to
> inform the sender as quickly as possible and delete this message
> and any copies of this message from your computer and/or your
> computer system network.
> ************************************************************************
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>