camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: null safe operator on exceptions
Date Fri, 04 Mar 2016 09:05:34 GMT
Hi

The method is called getStackTrace(), so you should do ${exception?.stackTrace}

And the simple function "exception.stackTrace" is not using OGNL but a
special function that also converts the stracktrace to a string. If
you call getStackTrace on an exception it returns an array of stack
elements (not the same).



On Fri, Mar 4, 2016 at 9:14 AM, Hans Orbaan <hans.orbaan@docdata.eu> wrote:
> Hi all,
>
> In the simple language you can use the null safe operator (?.) to avoid null pointer
exceptions. This does not work for the ${exception.stacktrace} like: ${exception?.stacktrace}.
>
> .log(LoggingLevel.WARN, "${exception?.stacktrace}")
>
> 2016-03-04 09:04:46,969 [main] org.apache.camel.processor.FatalFallbackErrorHandler -
ERROR - Exception occurred while trying to handle previously thrown exception on exchangeId:
ID-PC0480-55853-1457078686408-0-2 using: [Pipeline[[Channel[Log(myRoute)[ggggg]], Channel[Log(myRoute)[exchangeExceptionOgnl(?.stacktrace)]],
Channel[Multicast[[Channel[sendTo(Endpoint[mock://errors])]]]]]]]. The previous and the new
exception will be logged in the following.
> 2016-03-04 09:04:46,976 [main] org.apache.camel.processor.FatalFallbackErrorHandler -
ERROR - \--> Previous exception on exchangeId: ID-PC0480-55853-1457078686408-0-2
> 2016-03-04 09:04:46,978 [main] org.apache.camel.processor.FatalFallbackErrorHandler -
ERROR - \--> New exception on exchangeId: ID-PC0480-55853-1457078686408-0-2
>
> Is this something that could/should be fixed or are there reasons why that doesn't work?
>
> With kind regards,
>
> Hans Orbaan



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Mime
View raw message