oscerd opened a new pull request, #26541:
URL: https://github.com/apache/camel/pull/26541
Found by the same source audit of `components/camel-vertx` as #26533.
### The problem
`VertxWebsocketProducer.process` told its callback the exchange had finished
synchronously and told the
caller it had not:
```java
if (connectedPeers.isEmpty()) {
callback.done(true);
}
// Send message to each peer then record and process the results
asynchronously
connectedPeers.forEach(...); // nothing to iterate
return false;
```
`AsyncProcessor#process` documents the return value as `doneSync` — "true to
continue execution
synchronously, false to continue being executed asynchronously" — so `false`
says the exchange will be
finished later, by a write handler that never runs because there is nothing
to write to. The null-body
branch a few lines earlier in the same method already does it correctly
(`callback.done(true); return
true;`).
Easy to reach: `sendToAll` with nothing connected yet, or a
`CamelVertxWebsocket.connectionKey` that matches
no current peer.
### The change
The empty case completes the callback, returns `true`, and logs a WARN
naming the endpoint, so a message
that went nowhere is visible rather than silent.
A connection key that matches nothing was also dropped without a word, by
`.filter(peers::containsKey)`,
while a peer whose websocket turned out to be null one line further on did
warn. Both report now.
### Tests
`VertxWebsocketProducerNoPeerTest` (new, 2 cases) asserts what the contract
is about — the value `process`
returns, the single callback, and its `doneSync` flag — for a broadcast that
reaches no peer and for a null
body. The endpoint is built directly so nothing opens a connection.
**Confirmed the test catches this**: with the original completion handling
restored,
`anExchangeWithNoPeerIsDoneSynchronously` fails on the return value
(`Expecting value to be true but was
false`).
`mvn clean install -DskipITs` on `components/camel-vertx` is green — 87
tests. Full reactor
`mvn clean install -DskipTests -DskipITs -Dquickly` green.
`org.assertj:assertj-core` was not on this module's test classpath and is
added; #26533 adds the same line,
so whichever merges second will drop that hunk.
---
_Claude Code on behalf of oscerd_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]