Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-1777

AbstractExpressionEvaluator.evaluateExpression should log SpEL errors

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.5
    • Component/s: Core
    • Labels:
      None

      Description

      If I pass a SpEL expression which is incorrect for the object (e.g. I ask for payload.length on a String payload, instead of asking for payload.length()), then SpEL throws an EvaluationException, which AbstractExpressionEvaluator.evaluateExpression() wraps in MessagingException and re-throws.

      As this is likely to always be a bug, I'd prefer that I see some log output, at least at DEBUG log level (e.g. log.debug(e.getMessage()) would suffice within the catch block).

      Personally, I'm thinking WARN would be appropriate on a failed expression evaluation.

      The alternative AFAIK is that the MessagingException is either going to:

      • pass back up the call stack uncaught, so my unit test will see it and fail (for a DirectChannel)
      • be logged to an errorChannel if available (for async)
      • pass back as far as some other catch, such as in HttpRequestHandlingController, where it get's added to a ModelAndView against errorsKey.

      And... yes, I could argue that my test should be asserting that the errorsKey is not present or that there are no messages on the errors channel

        Attachments

          Activity

            People

            Assignee:
            oleg.zhurakousky@springsource.com Oleg Zhurakousky
            Reporter:
            nealeu Neale Upstone
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: