This type of thing should be logged but not throw an exception.  The level of 
error should be INFO.  So I like the idea of returning null, certainly null 
pointer is awful but throwing an exception is not much of an improved either.
 
-- Steve

________________________________

From: Adam Winer [mailto:[EMAIL PROTECTED]
Sent: Tue 8/28/2007 4:52 PM
To: MyFaces Development
Subject: Re: [Trinidad] Should FacesBean.getProperty(null) really throw an 
exception?



I'd personally rather have it throw an exception - it makes it harder to
catch errors if nulls are ignored in general.

-- Adam


On 8/28/07, Simon Lessard <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> Currenty, FacesBean.getProperty(null) throws a NullPointerException from the
> checkNotListKey method call. However, I feel it should rather return null
> and not throw an exception. That way, we would no longer have to use the
> following code snippet in our renderer to know if the property is supported
> on any given component:
> if (someKey == null)
> {
>   return null;
> }
> else
> {
>   return ComponentUtils.resolveSomeType(bean.getProperty(someKey),
> someDefaultValue);
> }
>
>  If getProperty were to return null instead of throwing an exception, only
> return line would be needed, reducing some boilerplate code in the various
> renderers.
>
> Any objection to make that change to FacesBeanImpl and reflect it in the
> FacesBean's javadoc?
>
>
> Regards,
>
> ~ Simon
>


<<winmail.dat>>

This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient,  you are not authorized 
to read, print, retain, copy, disseminate,  distribute, or use this message or 
any part thereof. If you receive this  message in error, please notify the 
sender immediately and delete all  copies of this message.

Reply via email to