[
https://issues.apache.org/jira/browse/CAMEL-13437?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16822075#comment-16822075
]
Duncan Doyle commented on CAMEL-13437:
--------------------------------------
PR: [https://github.com/apache/camel/pull/2876]
> 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
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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}
> Will fix and create a PR.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)