You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2019/04/22 11:48:00 UTC

[jira] [Resolved] (CAMEL-13437) ThrowExceptionProcessor should use 'getConstructor' instead of 'getDeclaredConstructor', so it doesn't force users to implement the constructors of their exception classes.

     [ https://issues.apache.org/jira/browse/CAMEL-13437?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-13437.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 2.22.5
                   2.23.3
                   3.0.0-M3
                   2.24.0
                   3.0.0

> 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
>             Fix For: 3.0.0, 2.24.0, 3.0.0-M3, 2.23.3, 2.22.5
>
>          Time Spent: 20m
>  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)