Andrea Cosentino created CAMEL-24623:
----------------------------------------

             Summary: 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


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)

Reply via email to