Defensive catching of any Throwable subclasses instead of just Error
Issue: SPR-14329
Issue: SPR-14323
(cherry picked from commit a9fda3e
)
This commit is contained in:
parent
2fd691b340
commit
e219576414
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -126,9 +126,9 @@ public abstract class AbstractMessageChannel implements MessageChannel, Intercep
|
|||
}
|
||||
throw new MessageDeliveryException(message,"Failed to send message to " + this, ex);
|
||||
}
|
||||
catch (Error ex) {
|
||||
catch (Throwable err) {
|
||||
MessageDeliveryException ex2 =
|
||||
new MessageDeliveryException(message, "Failed to send message to " + this, ex);
|
||||
new MessageDeliveryException(message, "Failed to send message to " + this, err);
|
||||
chain.triggerAfterSendCompletion(message, this, sent, ex2);
|
||||
throw ex2;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -99,7 +99,7 @@ public class ExecutorSubscribableChannel extends AbstractSubscribableChannel {
|
|||
|
||||
|
||||
/**
|
||||
* Invoke a MessageHandler with ExecutorChannelInterceptor's.
|
||||
* Invoke a MessageHandler with ExecutorChannelInterceptors.
|
||||
*/
|
||||
private class SendTask implements MessageHandlingRunnable {
|
||||
|
||||
|
@ -143,10 +143,11 @@ public class ExecutorSubscribableChannel extends AbstractSubscribableChannel {
|
|||
String description = "Failed to handle " + message + " to " + this + " in " + this.messageHandler;
|
||||
throw new MessageDeliveryException(message, description, ex);
|
||||
}
|
||||
catch (Error ex) {
|
||||
catch (Throwable err) {
|
||||
String description = "Failed to handle " + message + " to " + this + " in " + this.messageHandler;
|
||||
triggerAfterMessageHandled(message, new MessageDeliveryException(message, description, ex));
|
||||
throw ex;
|
||||
MessageDeliveryException ex2 = new MessageDeliveryException(message, description, err);
|
||||
triggerAfterMessageHandled(message, ex2);
|
||||
throw 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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -142,7 +142,7 @@ public class TransactionTemplate extends DefaultTransactionDefinition
|
|||
rollbackOnException(status, err);
|
||||
throw err;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
catch (Throwable ex) {
|
||||
// Transactional code threw unexpected exception -> rollback
|
||||
rollbackOnException(status, ex);
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -687,7 +687,7 @@ public class DispatcherPortlet extends FrameworkPortlet {
|
|||
throw ex;
|
||||
}
|
||||
}
|
||||
catch (Error err) {
|
||||
catch (Throwable err) {
|
||||
PortletException ex =
|
||||
new PortletException("Error occured during request processing: " + err.getMessage(), err);
|
||||
// Trigger after-completion for thrown exception.
|
||||
|
@ -800,7 +800,7 @@ public class DispatcherPortlet extends FrameworkPortlet {
|
|||
triggerAfterRenderCompletion(mappedHandler, interceptorIndex, request, response, ex);
|
||||
throw ex;
|
||||
}
|
||||
catch (Error err) {
|
||||
catch (Throwable err) {
|
||||
PortletException ex =
|
||||
new PortletException("Error occured during request processing: " + err.getMessage(), err);
|
||||
// Trigger after-completion for thrown exception.
|
||||
|
@ -891,7 +891,7 @@ public class DispatcherPortlet extends FrameworkPortlet {
|
|||
triggerAfterResourceCompletion(mappedHandler, interceptorIndex, request, response, ex);
|
||||
throw ex;
|
||||
}
|
||||
catch (Error err) {
|
||||
catch (Throwable err) {
|
||||
PortletException ex =
|
||||
new PortletException("Error occured during request processing: " + err.getMessage(), err);
|
||||
// Trigger after-completion for thrown exception.
|
||||
|
@ -965,7 +965,7 @@ public class DispatcherPortlet extends FrameworkPortlet {
|
|||
throw ex;
|
||||
}
|
||||
}
|
||||
catch (Error err) {
|
||||
catch (Throwable err) {
|
||||
PortletException ex =
|
||||
new PortletException("Error occured during request processing: " + err.getMessage(), err);
|
||||
// Trigger after-completion for thrown exception.
|
||||
|
|
|
@ -975,7 +975,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
|||
catch (Exception ex) {
|
||||
triggerAfterCompletion(processedRequest, response, mappedHandler, ex);
|
||||
}
|
||||
catch (Error err) {
|
||||
catch (Throwable err) {
|
||||
triggerAfterCompletionWithError(processedRequest, response, mappedHandler, err);
|
||||
}
|
||||
finally {
|
||||
|
@ -1300,7 +1300,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
|||
}
|
||||
|
||||
private void triggerAfterCompletionWithError(HttpServletRequest request, HttpServletResponse response,
|
||||
HandlerExecutionChain mappedHandler, Error error) throws Exception {
|
||||
HandlerExecutionChain mappedHandler, Throwable error) throws Exception {
|
||||
|
||||
ServletException ex = new NestedServletException("Handler processing failed", error);
|
||||
if (mappedHandler != null) {
|
||||
|
|
Loading…
Reference in New Issue