Defensive catching of any Throwable subclasses instead of just Error
Issue: SPR-14329
This commit is contained in:
parent
f657952cee
commit
a9fda3e7e2
|
|
@ -126,7 +126,7 @@ public abstract class AbstractMessageChannel implements MessageChannel, Intercep
|
||||||
}
|
}
|
||||||
throw new MessageDeliveryException(message,"Failed to send message to " + this, ex);
|
throw new MessageDeliveryException(message,"Failed to send message to " + this, ex);
|
||||||
}
|
}
|
||||||
catch (Error err) {
|
catch (Throwable err) {
|
||||||
MessageDeliveryException ex2 =
|
MessageDeliveryException ex2 =
|
||||||
new MessageDeliveryException(message, "Failed to send message to " + this, err);
|
new MessageDeliveryException(message, "Failed to send message to " + this, err);
|
||||||
chain.triggerAfterSendCompletion(message, this, sent, ex2);
|
chain.triggerAfterSendCompletion(message, this, sent, ex2);
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ public class ExecutorSubscribableChannel extends AbstractSubscribableChannel {
|
||||||
String description = "Failed to handle " + message + " to " + this + " in " + this.messageHandler;
|
String description = "Failed to handle " + message + " to " + this + " in " + this.messageHandler;
|
||||||
throw new MessageDeliveryException(message, description, ex);
|
throw new MessageDeliveryException(message, description, ex);
|
||||||
}
|
}
|
||||||
catch (Error err) {
|
catch (Throwable err) {
|
||||||
String description = "Failed to handle " + message + " to " + this + " in " + this.messageHandler;
|
String description = "Failed to handle " + message + " to " + this + " in " + this.messageHandler;
|
||||||
MessageDeliveryException ex2 = new MessageDeliveryException(message, description, err);
|
MessageDeliveryException ex2 = new MessageDeliveryException(message, description, err);
|
||||||
triggerAfterMessageHandled(message, ex2);
|
triggerAfterMessageHandled(message, ex2);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -142,7 +142,7 @@ public class TransactionTemplate extends DefaultTransactionDefinition
|
||||||
rollbackOnException(status, err);
|
rollbackOnException(status, err);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Throwable ex) {
|
||||||
// Transactional code threw unexpected exception -> rollback
|
// Transactional code threw unexpected exception -> rollback
|
||||||
rollbackOnException(status, ex);
|
rollbackOnException(status, ex);
|
||||||
throw new UndeclaredThrowableException(ex, "TransactionCallback threw undeclared checked exception");
|
throw new UndeclaredThrowableException(ex, "TransactionCallback threw undeclared checked exception");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -687,7 +687,7 @@ public class DispatcherPortlet extends FrameworkPortlet {
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Error err) {
|
catch (Throwable err) {
|
||||||
PortletException ex =
|
PortletException ex =
|
||||||
new PortletException("Error occured during request processing: " + err.getMessage(), err);
|
new PortletException("Error occured during request processing: " + err.getMessage(), err);
|
||||||
// Trigger after-completion for thrown exception.
|
// Trigger after-completion for thrown exception.
|
||||||
|
|
@ -800,7 +800,7 @@ public class DispatcherPortlet extends FrameworkPortlet {
|
||||||
triggerAfterRenderCompletion(mappedHandler, interceptorIndex, request, response, ex);
|
triggerAfterRenderCompletion(mappedHandler, interceptorIndex, request, response, ex);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
catch (Error err) {
|
catch (Throwable err) {
|
||||||
PortletException ex =
|
PortletException ex =
|
||||||
new PortletException("Error occured during request processing: " + err.getMessage(), err);
|
new PortletException("Error occured during request processing: " + err.getMessage(), err);
|
||||||
// Trigger after-completion for thrown exception.
|
// Trigger after-completion for thrown exception.
|
||||||
|
|
@ -891,7 +891,7 @@ public class DispatcherPortlet extends FrameworkPortlet {
|
||||||
triggerAfterResourceCompletion(mappedHandler, interceptorIndex, request, response, ex);
|
triggerAfterResourceCompletion(mappedHandler, interceptorIndex, request, response, ex);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
catch (Error err) {
|
catch (Throwable err) {
|
||||||
PortletException ex =
|
PortletException ex =
|
||||||
new PortletException("Error occured during request processing: " + err.getMessage(), err);
|
new PortletException("Error occured during request processing: " + err.getMessage(), err);
|
||||||
// Trigger after-completion for thrown exception.
|
// Trigger after-completion for thrown exception.
|
||||||
|
|
@ -965,7 +965,7 @@ public class DispatcherPortlet extends FrameworkPortlet {
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Error err) {
|
catch (Throwable err) {
|
||||||
PortletException ex =
|
PortletException ex =
|
||||||
new PortletException("Error occured during request processing: " + err.getMessage(), err);
|
new PortletException("Error occured during request processing: " + err.getMessage(), err);
|
||||||
// Trigger after-completion for thrown exception.
|
// Trigger after-completion for thrown exception.
|
||||||
|
|
|
||||||
|
|
@ -972,7 +972,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
dispatchException = ex;
|
dispatchException = ex;
|
||||||
}
|
}
|
||||||
catch (Error err) {
|
catch (Throwable err) {
|
||||||
// As of 4.3, we're processing Errors thrown from handler methods as well,
|
// As of 4.3, we're processing Errors thrown from handler methods as well,
|
||||||
// making them available for @ExceptionHandler methods and other scenarios.
|
// making them available for @ExceptionHandler methods and other scenarios.
|
||||||
dispatchException = new NestedServletException("Handler dispatch failed", err);
|
dispatchException = new NestedServletException("Handler dispatch failed", err);
|
||||||
|
|
@ -982,7 +982,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
triggerAfterCompletion(processedRequest, response, mappedHandler, ex);
|
triggerAfterCompletion(processedRequest, response, mappedHandler, ex);
|
||||||
}
|
}
|
||||||
catch (Error err) {
|
catch (Throwable err) {
|
||||||
triggerAfterCompletion(processedRequest, response, mappedHandler,
|
triggerAfterCompletion(processedRequest, response, mappedHandler,
|
||||||
new NestedServletException("Handler processing failed", err));
|
new NestedServletException("Handler processing failed", err));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue