Skip to content

Commit f2fb016

Browse files
committed
* Check this.discardChannel first
* `Assert.state()` in `doInit()` for mutual exclusiveness
1 parent 62d3f4b commit f2fb016

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

spring-integration-core/src/main/java/org/springframework/integration/splitter/AbstractMessageSplitter.java

+12-4
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,22 @@ public void setDiscardChannelName(String discardChannelName) {
9696

9797
@Override
9898
public MessageChannel getDiscardChannel() {
99-
String channelName = this.discardChannelName;
100-
if (channelName != null) {
101-
this.discardChannel = getChannelResolver().resolveDestination(channelName);
102-
this.discardChannelName = null;
99+
if (this.discardChannel == null) {
100+
String channelName = this.discardChannelName;
101+
if (channelName != null) {
102+
this.discardChannel = getChannelResolver().resolveDestination(channelName);
103+
this.discardChannelName = null;
104+
}
103105
}
104106
return this.discardChannel;
105107
}
106108

109+
@Override
110+
protected void doInit() {
111+
Assert.state(!(this.discardChannelName != null && this.discardChannel != null),
112+
"'discardChannelName' and 'discardChannel' are mutually exclusive.");
113+
}
114+
107115
@Override
108116
@SuppressWarnings("unchecked")
109117
protected final Object handleRequestMessage(Message<?> message) {

0 commit comments

Comments
 (0)