oscerd opened a new pull request, #26111:
URL: https://github.com/apache/camel/pull/26111
Found by a source audit of `components/camel-infinispan`.
### The problem
Both producers run the `QUERY` operation through an unguarded `if`:
```java
final Query<?> query = InfinispanRemoteUtil.buildQuery(getConfiguration(),
cache, message);
if (query != null) {
setResult(message, query.execute().list());
}
```
and `buildQuery` returns `null` when neither the `queryBuilder` endpoint
option nor the
`CamelInfinispanQueryBuilder` header is set. A route running
`operation=QUERY` without a builder therefore
gets its own message back — no result, no exception, no log line — which is
indistinguishable from a query
that legitimately matched nothing.
### The change
**The pass-through is kept.** `producerQueryOperationWithoutQueryBuilder`
has asserted "no exception, no
result" since the operation was contributed in CAMEL-9624 (2016), and the
same test exists on the embedded
side, so failing the exchange would revert a deliberate, decade-old contract
and would need an
upgrade-guide entry — disproportionate for what is a route misconfiguration.
What changes is only the silence:
* both producers log a WARN naming the cache, the `queryBuilder` option and
the `CamelInfinispanQueryBuilder`
header;
* the builder is resolved **before** the cache is looked up, so a
misconfigured remote route no longer pays a
Hot Rod round trip to do nothing;
* `InfinispanEmbeddedProducer.onQuery` carried the identical defect — the
audit only cited the remote one —
and is fixed the same way.
If you would rather have it throw, that is a one-line change plus those two
tests and an upgrade note; say
so and I will follow up.
### Tests
`InfinispanRemoteProducerQueryTest` (new, 4 tests): the pass-through still
happens and reaches no cache (the
manager it runs against was never started, so any remote call would fail),
and the header-vs-option
precedence of the builder, which had no coverage at all.
`mvn test` on both modules is green — 89 embedded tests, including the 2016
`producerQueryOperationWithoutQueryBuilder`
against a real embedded cache, and 13 remote ones. Full reactor `mvn clean
install -DskipTests -Dquickly` green.
---
_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]