Browse Source

ExecutorSubscribableChannel consistently rethrows Error as MessageDeliveryException

Issue: SPR-14323
pull/1031/merge
Juergen Hoeller 9 years ago
parent
commit
e4976a2c6d
  1. 6
      spring-messaging/src/main/java/org/springframework/messaging/support/AbstractMessageChannel.java
  2. 11
      spring-messaging/src/main/java/org/springframework/messaging/support/ExecutorSubscribableChannel.java

6
spring-messaging/src/main/java/org/springframework/messaging/support/AbstractMessageChannel.java

@ -1,5 +1,5 @@ @@ -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 @@ -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;
}

11
spring-messaging/src/main/java/org/springframework/messaging/support/ExecutorSubscribableChannel.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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 { @@ -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;
}
}

Loading…
Cancel
Save