Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-1888

CamelInvocationHandler should throw RuntimeException if possible instead of InvocationTargetException

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0-M3
    • 2.0.0
    • camel-core, camel-spring
    • None
    • XP, JDK 1.5.0_16

    • Patch Available

    Description

      The CamelInvocationHandler.invoke() method should throw the RuntimeException if the fault is a RuntimeException instead of throwing an InvocationTargetException with the RuntimeException included.

      This would allow to use the @Produce to inject a direct endpoint on a pojo (that acts as a service interface) and the calling side would receive the RuntimeException instead of the UndeclaredThrowableException. With this behaviour the error handling on the calling side would be the same as if no camel route is between the caller and the called pojo.

      The attached testcase is based on the original testcase that was commited here: http://svn.apache.org/viewvc?view=rev&revision=801511

      See also http://www.nabble.com/Camel-Spring-Remoting-throwing-RuntimeException-question-td24825646.html for more info.

      Attachments

        1. camel-spring-1888.patch
          7 kB
          Andreas Kuhtz
        2. camel-core-1888.patch
          1.0 kB
          Andreas Kuhtz

        Activity

          People

            njiang Willem Jiang
            akuhtz Andreas Kuhtz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: