Overview

While working on #33013, I noticed that we don't unwrap an InvocationTargetException in SpEL's FunctionReference; however, we do unwrap those in ConstructorReference and MethodReference.

For example, currently one may encounter an exception like this:

SpelEvaluationException: EL1023E: A problem occurred whilst attempting to invoke the function 'formatObjectVarargs': 'null'

That 'null' comes from the fact that an InvocationTargetException doesn't have a message. Instead, we should unwrap the InvocationTargetException to use its cause for the exception message, resulting in something like this:

SpelEvaluationException: EL1023E: A problem occurred whilst attempting to invoke the function 'formatObjectVarargs': 'Format specifier '%s''