gnodet-bot commented on code in PR #31172:
URL: https://github.com/apache/camel/pull/31172#discussion_r4756961935
##########
components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java:
##########
@@ -268,16 +272,17 @@ public BlockingQueue<Exchange> getQueue() {
// can use the already existing queue referenced from the
component; a released or
// de-listed reference must not be reused as the component no
longer tracks it
if (getComponent() != null) {
- // use null to indicate default size (= use what the
existing queue has been configured with)
- Integer size = (getSize() == Integer.MAX_VALUE ||
getSize() == SedaConstants.QUEUE_SIZE) ? null : getSize();
+ // use null to indicate default size (= use what the
existing queue has been configured with);
+ // only treat the size as "not set" when the user has not
explicitly configured it
+ Integer size = sizeSet ? getSize() : null;
Review Comment:
⚠️ **Regression — `size=Integer.MAX_VALUE` on a shared unbounded queue
throws `IllegalArgumentException`.**
`getOrCreateQueue` checks `size != null && !size.equals(ref.getSize())`.
When a queue was registered as unbounded (`ref.getSize() == null`) and this
endpoint explicitly set `size=MAX_VALUE`, the old code mapped `MAX_VALUE →
null`; this code passes `Integer.MAX_VALUE` → mismatch → `IAE`. The fix is to
keep the unbounded-equals-null mapping at the call site.
```suggestion
Integer size = sizeSet ? (getSize() == Integer.MAX_VALUE
? null : getSize()) : null;
```
##########
components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java:
##########
@@ -661,7 +676,7 @@ private void registerQueueIfStale() {
// re-register when a producer or consumer restarts after the
queue was released on stop, or
// when this endpoint was dropped from a reference still shared
with other endpoints; the
// stale ref/queue fields may be non-null while no longer
registered with the component
- Integer size = (getSize() == Integer.MAX_VALUE || getSize() ==
SedaConstants.QUEUE_SIZE) ? null : getSize();
+ Integer size = sizeSet ? getSize() : null;
Review Comment:
Same regression as above in `registerQueueIfStale()` — apply the same fix.
```suggestion
Integer size = sizeSet ? (getSize() == Integer.MAX_VALUE ? null
: getSize()) : null;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]