Duncan Doyle created CAMEL-13437:
------------------------------------

             Summary: ThrowExceptionProcessor should use 'getConstructor' 
instead of 'getDeclaredConstructor', so it doesn't force users to implement the 
constructors of their exception classes.
                 Key: CAMEL-13437
                 URL: https://issues.apache.org/jira/browse/CAMEL-13437
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.23.2
            Reporter: Duncan Doyle


ThrowExceptionProcessor uses this line of code to retrieve the constructor of 
an Exception class:
{code:java}
Constructor<?> constructor = type.getDeclaredConstructor(String.class);{code}
The problem is that this will only find constructors defined in the actual 
class itself, not in its superclasses. This forces users to unnecessarily 
implement a constructor that excepts a {{String}} in their custom exception 
classes.

Easy fix, use the following method:
{code:java}
Constructor<?> constructor = type.getConstructor(String.class);{code}
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to