Merge pull request #27801 from Drezir

* pr/27801:
  Polish formatting
  Polish ExceptionHandlerMethodResolver mapping

Closes gh-27801
This commit is contained in:
Stephane Nicoll 2021-12-13 16:01:45 +01:00
commit 21c3623cdc
1 changed files with 2 additions and 5 deletions

View File

@ -476,11 +476,8 @@ public class ExceptionHandlerExceptionResolver extends AbstractHandlerMethodExce
// Local exception handler methods on the controller class itself. // Local exception handler methods on the controller class itself.
// To be invoked through the proxy, even in case of an interface-based proxy. // To be invoked through the proxy, even in case of an interface-based proxy.
handlerType = handlerMethod.getBeanType(); handlerType = handlerMethod.getBeanType();
ExceptionHandlerMethodResolver resolver = this.exceptionHandlerCache.get(handlerType); ExceptionHandlerMethodResolver resolver = this.exceptionHandlerCache.computeIfAbsent(
if (resolver == null) { handlerType, ExceptionHandlerMethodResolver::new);
resolver = new ExceptionHandlerMethodResolver(handlerType);
this.exceptionHandlerCache.put(handlerType, resolver);
}
Method method = resolver.resolveMethod(exception); Method method = resolver.resolveMethod(exception);
if (method != null) { if (method != null) {
return new ServletInvocableHandlerMethod(handlerMethod.getBean(), method, this.applicationContext); return new ServletInvocableHandlerMethod(handlerMethod.getBean(), method, this.applicationContext);