On 9/3/07, Brian McCallister <[EMAIL PROTECTED]> wrote:
>
> On Sep 3, 2007, at 7:07 AM, Hadrian Zbarcea wrote:
>
> > On the CAMEL-84 topic, I think returning null is a valid normal
> > case, not an exceptional one.  If a null is an acceptable answer is
> > imho for the caller to decide (which is what the JournalEndpoint in
> > jpa does already).
>
> Actually, the exception is what makes NULL a valid value. If NULL can
> be both a valid value and no-conversion-available, you caannot know
> which one it is.
>
> If the journal or jpa decide to return null for correct reasons (I am
> curious when this would be correct, but that is a tangent) then they
> may throw an exception in the case where they couldn't convert. Now
> you get both worlds.

I guess thats the thing; if NULL is a valid type conversion result,
then we need an exception to differentiate.

I can't think of too many sane examples of NULL being a valid type
conversion result though :). But I guess the lack of a type converter
should be considered an exceptional case.

Imagine a use case where a type converter lives in some jar on the
classpath; things are working great, but then at a later date, someone
removes something from the classpath; all of a sudden we're gonna have
null payloads in messages and no real exception / log / knowledge of
why things just started failing.

So I'm kinda thinking we should patch the use of 'null' as no type
conversion available and instead use exceptions. (Its gonna take a
while to convert all the type conversion code to use this model
though).

-- 
James
-------
http://macstrac.blogspot.com/

Reply via email to