camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <>
Subject [jira] Created: (CAMEL-899) Check all code - RuntimeCamelException should be properly wrapped
Date Sun, 14 Sep 2008 11:38:52 GMT
Check all code - RuntimeCamelException should be properly wrapped

                 Key: CAMEL-899
             Project: Apache Camel
          Issue Type: Task
    Affects Versions: 1.4.0
            Reporter: Claus Ibsen
            Priority: Minor

Code such as:
catch (Exception e) {
   throw new RuntimeCamelException(e);

should use a wrapper check if the exception is already a RuntimeCamelException. If not then
we get nested pointless wrappings. In fact the TraceInterceptor in camel-spring had this and
depending on how long your route was you would get N deep wrappings.

The following code should be in camel-core somewhere:
     * Wraps the caused exception in a RuntimeCamelException if its not already such an exception
    private static RuntimeCamelException wrapRuntimeCamelException(Throwable e) {
        // TODO: Move to camel-core
        if (e instanceof RuntimeCamelException) {
            // dont double wrap if already a RuntimeCamelException
            return (RuntimeCamelException) e;
        } else {
            return new RuntimeCamelException(e);

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message