[
https://issues.apache.org/jira/browse/CAMEL-24623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18111467#comment-18111467
]
Andrea Cosentino commented on CAMEL-24623:
------------------------------------------
Design note after investigating the history.
The lenient behaviour is not accidental:
{{producerQueryOperationWithoutQueryBuilder}} has asserted "no exception, no
result" since the QUERY operation was contributed in CAMEL-9624 (2016), and the
same test exists for the embedded module. Failing the exchange would revert
that deliberate contract and would need an upgrade-guide entry, which is
disproportionate for what is a route misconfiguration.
The fix therefore keeps the contract and removes only the silence:
* both producers now log a WARN naming the cache, the {{queryBuilder}} option
and the {{CamelInfinispanQueryBuilder}} header, instead of returning quietly;
* 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;
* the same defect was present in {{InfinispanEmbeddedProducer.onQuery}} - the
audit only cited the remote one - and is fixed there too.
If you would rather have it throw, that is a one-line change plus the two
existing tests and an upgrade note; say so on the PR.
_Claude Code on behalf of oscerd_
> camel-infinispan: the QUERY operation silently returns the input when no
> query builder is set
> ---------------------------------------------------------------------------------------------
>
> Key: CAMEL-24623
> URL: https://issues.apache.org/jira/browse/CAMEL-24623
> Project: Camel
> Issue Type: Bug
> Components: camel-infinispan
> Reporter: Andrea Cosentino
> Assignee: Andrea Cosentino
> Priority: Minor
>
> h3. Summary
> The {{QUERY}} operation of the remote producer silently returns the exchange
> unchanged when no query builder is available, instead of failing.
> h3. Detail
> {{InfinispanRemoteProducer.onQuery}} ({{camel-infinispan}}) line 55:
> {code:java}
> final Query<?> query = InfinispanRemoteUtil.buildQuery(getConfiguration(),
> cache, message);
> if (query != null) {
> setResult(message, query.execute().list());
> }
> {code}
> There is no {{else}} branch, and {{InfinispanRemoteUtil.buildQuery}} line 63
> returns {{null}} when no builder is set:
> {code:java}
> return queryBuilder != null ? queryBuilder.build(cache) : null;
> {code}
> A route that runs {{operation=QUERY}} without setting either the
> {{CamelInfinispanQueryBuilder}} header or the {{queryBuilder}} endpoint
> option therefore gets its own input body back as though it were the query
> result - no result, no exception, no log line. The failure is
> indistinguishable from a query that legitimately returned nothing, which
> makes it hard to diagnose.
> The producer should fail with a clear message naming both ways of supplying
> the builder.
> Found by a source audit of {{components/camel-infinispan}} at 10f750a2d61f.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)