@ExceptionHandler works for inherited method and CGLIB proxies on Portlet controllers as well (SPR-7337)

This commit is contained in:
Juergen Hoeller
2010-07-08 11:45:35 +00:00
parent cb72fe1be2
commit 7e9e8401f7
2 changed files with 26 additions and 5 deletions

View File

@@ -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 {