Impacted Version: spring-webmvc-6.0.4
Previously
DefaultHandlerExceptionResolver::doResolveException(HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex)
would return the ModelAndView when it was resolved from one of the specific methods (like handleHttpRequestMethodNotSupported)
Starting with 6, this method now sets a local variable of the ModelAndView and then does NOT return it. It ALWAYS returns null. in these cases.
see https://github.com/spring-projects/spring-framework/blob/main/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java#L167-L248
Comment From: rstoyanchev
I presume the case is when you override a protected method to handle an exception, and return a ModelAndView
rather than calling response#sendError
, then the resulting ModelAndView
is being ignored?
Comment From: ryber
yes, well, specifically I'm getting a NullPointerException because I am expecting it to be returned
Comment From: ryber
for now I have copied in the method from Spring 5 as a workaround