@ExceptionHandler works for inherited method and CGLIB proxies on Portlet controllers as well (SPR-7337)
This commit is contained in:
@@ -90,6 +90,15 @@ public class AnnotationMethodHandlerExceptionResolverTests {
|
||||
assertEquals("Invalid view name returned", "Y:BindException", mav.getViewName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void inherited() {
|
||||
IOException ex = new IOException();
|
||||
InheritedController controller = new InheritedController();
|
||||
ModelAndView mav = exceptionResolver.resolveException(request, response, controller, ex);
|
||||
assertNotNull("No ModelAndView returned", mav);
|
||||
assertEquals("Invalid view name returned", "GenericError", mav.getViewName());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void ambiguous() {
|
||||
IllegalArgumentException ex = new IllegalArgumentException();
|
||||
@@ -119,6 +128,16 @@ public class AnnotationMethodHandlerExceptionResolverTests {
|
||||
}
|
||||
|
||||
|
||||
@Controller
|
||||
private static class InheritedController extends SimpleController {
|
||||
|
||||
@Override
|
||||
public String handleIOException(IOException ex, PortletRequest request) {
|
||||
return "GenericError";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Controller
|
||||
private static class AmbiguousController {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user