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()`
This commit is contained in:
Zahid Khan
2022-07-06 23:48:34 +05:30
committed by GitHub
parent bb91fd3cb3
commit ae1aaad67a

View File

@@ -87,7 +87,9 @@ public class DirectChannel extends AbstractSubscribableChannel {
super.onInit();
if (this.maxSubscribers == null) {
Integer max = getIntegrationProperty(IntegrationProperties.CHANNELS_MAX_UNICAST_SUBSCRIBERS, Integer.class);
setMaxSubscribers(max);
if (max != null) {
setMaxSubscribers(max);
}
}
}