Logging as INFO seems the worst of all worlds. Either null property keys are right or wrong.
If they're wrong, then logging at SEVERE and returning null might be OK, NullPointerException is also acceptable - which you want depends mostly on who will see the error. If end users will see the error, logging at SEVERE is (often) better. If developers on the project will see it, throwing an exception is correct. If null PropertyKeys are OK, then logging at FINE or FINER or FINEST is acceptable - but not at INFO. -- Adam On 8/28/07, Steven Murray <[EMAIL PROTECTED]> wrote: > 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 > > > > > >
