ExecutorSubscribableChannel consistently rethrows Error as MessageDeliveryException

Issue: SPR-14323
This commit is contained in:
Juergen Hoeller
2016-06-01 11:38:56 +02:00
parent fc40643033
commit e4976a2c6d
2 changed files with 9 additions and 8 deletions

View File

@@ -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 (Error 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;
}

View File

@@ -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 (Error 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;
}
}