Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.0
    • Fix Version/s: 2.8.3, 2.9.0
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      When a bean in a traced route throws an exception (e.g. NullPointerException) one would expect to see that in the causedByException property of the DefaultTraceEventMessage. But the exception is null.

      The reason is that in DefaultTraceEventMessage the causedByException is set to exchange.getException(), at a time where it is already handled. The exception is still available as property Exchange.EXCEPTION_CAUGHT.

      Suggestion for change:

      public DefaultTraceEventMessage(final Date timestamp, final ProcessorDefinition<?> toNode, final Exchange exchange) {
              this.tracedExchange = exchange;
              ...
              this.causedByException = exchange.getException() != null ? exchange.getException().toString()
      				: extractExceptionCaught(exchange);
      } 
       
      // used to set causedByException in cases where the exception is already handled 
      private static String extractExceptionCaught(Exchange exchange) {
       	Exception exceptionCaught = (Exception) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
       	return (exceptionCaught != null ? exceptionCaught.toString() : null);
      }
      

        Activity

          People

          • Assignee:
            Claus Ibsen
            Reporter:
            Alfred Hiebl
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development