Skip to content

Commit ae1aaad

Browse files
authored
Check for null before setting maxSubscribers
The `DirectChannel` doesn't check a result of the `getIntegrationProperty()`. This may cause NPE problem with unconditional `setMaxSubscribers(int)` call. * Check `Integer max` for `null` before propagating to the `setMaxSubscribers()`
1 parent bb91fd3 commit ae1aaad

File tree

1 file changed

+3
-1
lines changed
  • spring-integration-core/src/main/java/org/springframework/integration/channel

1 file changed

+3
-1
lines changed

spring-integration-core/src/main/java/org/springframework/integration/channel/DirectChannel.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ protected void onInit() {
8787
super.onInit();
8888
if (this.maxSubscribers == null) {
8989
Integer max = getIntegrationProperty(IntegrationProperties.CHANNELS_MAX_UNICAST_SUBSCRIBERS, Integer.class);
90-
setMaxSubscribers(max);
90+
if (max != null) {
91+
setMaxSubscribers(max);
92+
}
9193
}
9294
}
9395

0 commit comments

Comments
 (0)