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

ThrowExceptionProcessor should use 'getConstructor' instead of 'getDeclaredConstructor', so it doesn't force users to implement the constructors of their exception classes.

    XMLWordPrintableJSON

    Details

    • Estimated Complexity:
      Unknown

      Description

      ThrowExceptionProcessor uses this line of code to retrieve the constructor of an Exception class:

      Constructor<?> constructor = type.getDeclaredConstructor(String.class);

      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:

      Constructor<?> constructor = type.getConstructor(String.class);

       Will fix and create a PR.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mccloud Duncan Doyle
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m