I have the global application handler in my spring mvc application:
@ExceptionHandler(value = Throwable.class)
public ModelAndView redirectToErrorPage(Exception e) {
...
}
In place#1 I write following code:
@Override
public void save(Content content, MultipartFile multipartFile) {
if (true) {
throw new RuntimeException();
}
}
after throw RuntimeException program execution goes to method redirectToErrorPage
If to replace
throw new RuntimeException()
with
throw new OutOfMemoryError()
then program execution doesn't go over to the redirectToErrorPage
method.
Why?