You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Claus Ibsen <cl...@gmail.com> on 2009/03/10 07:29:15 UTC

Camel 2.0 API - Discuss - Exchange.getException() change to Exception

Hi

The Exchange.getException() method is based on Throwable. I think this
is wrong and we should change it to Exception.

We should let the java.lang.Error left alone to the JDK itself to
handle it, so end users cannot try .. catch(Throwable) and thus
hide java.lang.OutOfMemoryError etc.

The camel-core has this issue as well with catching Throwables around
its code. It should only catch Exception.
And I am prepareing a patch to fix this.

Any objections to change it to Exception and fix the camel-core?



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Camel 2.0 API - Discuss - Exchange.getException() change to Exception

Posted by Claus Ibsen <cl...@gmail.com>.
Committed revision 752465.

On Wed, Mar 11, 2009 at 12:58 PM, James Strachan
<ja...@gmail.com> wrote:
> 2009/3/11 Claus Ibsen <cl...@gmail.com>:
>> On Wed, Mar 11, 2009 at 12:20 PM, James Strachan
>> <ja...@gmail.com> wrote:
>>> 2009/3/10 Claus Ibsen <cl...@gmail.com>:
>>>> Hi
>>>>
>>>> The Exchange.getException() method is based on Throwable. I think this
>>>> is wrong and we should change it to Exception.
>>>>
>>>> We should let the java.lang.Error left alone to the JDK itself to
>>>> handle it, so end users cannot try .. catch(Throwable) and thus
>>>> hide java.lang.OutOfMemoryError etc.
>>>>
>>>> The camel-core has this issue as well with catching Throwables around
>>>> its code. It should only catch Exception.
>>>> And I am prepareing a patch to fix this.
>>>>
>>>> Any objections to change it to Exception and fix the camel-core?
>>>
>>> Sounds fine to me. So long as we can catch programming bugs (e.g.
>>> NullPointerException in some custom processor code) that should be
>>> fine.
>> ? NPE is a RuntimeException so it would be just as it always have been.
>>
>> Its just that we let java.lang.Error to the JDK itself, so when it
>> reports OutOfMemoryError, and that infinite stack trace error and what
>> else then Camel do NOT catch it.
>
> Yes - sorry thats what I meant. That checked & runtime exceptions
> should be catchable - but errors like OOM shouldnt.
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://fusesource.com/
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Camel 2.0 API - Discuss - Exchange.getException() change to Exception

Posted by James Strachan <ja...@gmail.com>.
2009/3/11 Claus Ibsen <cl...@gmail.com>:
> On Wed, Mar 11, 2009 at 12:20 PM, James Strachan
> <ja...@gmail.com> wrote:
>> 2009/3/10 Claus Ibsen <cl...@gmail.com>:
>>> Hi
>>>
>>> The Exchange.getException() method is based on Throwable. I think this
>>> is wrong and we should change it to Exception.
>>>
>>> We should let the java.lang.Error left alone to the JDK itself to
>>> handle it, so end users cannot try .. catch(Throwable) and thus
>>> hide java.lang.OutOfMemoryError etc.
>>>
>>> The camel-core has this issue as well with catching Throwables around
>>> its code. It should only catch Exception.
>>> And I am prepareing a patch to fix this.
>>>
>>> Any objections to change it to Exception and fix the camel-core?
>>
>> Sounds fine to me. So long as we can catch programming bugs (e.g.
>> NullPointerException in some custom processor code) that should be
>> fine.
> ? NPE is a RuntimeException so it would be just as it always have been.
>
> Its just that we let java.lang.Error to the JDK itself, so when it
> reports OutOfMemoryError, and that infinite stack trace error and what
> else then Camel do NOT catch it.

Yes - sorry thats what I meant. That checked & runtime exceptions
should be catchable - but errors like OOM shouldnt.

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

Open Source Integration
http://fusesource.com/

Re: Camel 2.0 API - Discuss - Exchange.getException() change to Exception

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Mar 11, 2009 at 12:20 PM, James Strachan
<ja...@gmail.com> wrote:
> 2009/3/10 Claus Ibsen <cl...@gmail.com>:
>> Hi
>>
>> The Exchange.getException() method is based on Throwable. I think this
>> is wrong and we should change it to Exception.
>>
>> We should let the java.lang.Error left alone to the JDK itself to
>> handle it, so end users cannot try .. catch(Throwable) and thus
>> hide java.lang.OutOfMemoryError etc.
>>
>> The camel-core has this issue as well with catching Throwables around
>> its code. It should only catch Exception.
>> And I am prepareing a patch to fix this.
>>
>> Any objections to change it to Exception and fix the camel-core?
>
> Sounds fine to me. So long as we can catch programming bugs (e.g.
> NullPointerException in some custom processor code) that should be
> fine.
? NPE is a RuntimeException so it would be just as it always have been.

Its just that we let java.lang.Error to the JDK itself, so when it
reports OutOfMemoryError, and that infinite stack trace error and what
else then Camel do NOT catch it.



>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://fusesource.com/
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Camel 2.0 API - Discuss - Exchange.getException() change to Exception

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

I just checked the servicemix-camel component , it will not be effect by
this change.

So I +1 for this change.

Willem

James Strachan wrote:
> 2009/3/10 Claus Ibsen <cl...@gmail.com>:
>> Hi
>>
>> The Exchange.getException() method is based on Throwable. I think this
>> is wrong and we should change it to Exception.
>>
>> We should let the java.lang.Error left alone to the JDK itself to
>> handle it, so end users cannot try .. catch(Throwable) and thus
>> hide java.lang.OutOfMemoryError etc.
>>
>> The camel-core has this issue as well with catching Throwables around
>> its code. It should only catch Exception.
>> And I am prepareing a patch to fix this.
>>
>> Any objections to change it to Exception and fix the camel-core?
> 
> Sounds fine to me. So long as we can catch programming bugs (e.g.
> NullPointerException in some custom processor code) that should be
> fine.
> 


Re: Camel 2.0 API - Discuss - Exchange.getException() change to Exception

Posted by James Strachan <ja...@gmail.com>.
2009/3/10 Claus Ibsen <cl...@gmail.com>:
> Hi
>
> The Exchange.getException() method is based on Throwable. I think this
> is wrong and we should change it to Exception.
>
> We should let the java.lang.Error left alone to the JDK itself to
> handle it, so end users cannot try .. catch(Throwable) and thus
> hide java.lang.OutOfMemoryError etc.
>
> The camel-core has this issue as well with catching Throwables around
> its code. It should only catch Exception.
> And I am prepareing a patch to fix this.
>
> Any objections to change it to Exception and fix the camel-core?

Sounds fine to me. So long as we can catch programming bugs (e.g.
NullPointerException in some custom processor code) that should be
fine.

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

Open Source Integration
http://fusesource.com/