Claus Ibsen created CAMEL-27977:
-----------------------------------

             Summary: camel-olingo2: configuration equals() ignores most 
fields, endpoint proxy replaces the shared one, httpClientBuilder unused
                 Key: CAMEL-27977
                 URL: https://issues.apache.org/jira/browse/CAMEL-27977
             Project: Camel
          Issue Type: Bug
          Components: camel-olingo2
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-olingo2 for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31202).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. Olingo2Configuration.equals() compares too little
{{Olingo2Configuration.equals}} mixes the && chain with ?: without parentheses. 
Once serviceUri is not null and contentType is equal with httpHeaders null on 
both, it returns true even when serviceUri, the timeouts, proxy, SSL settings 
or the builders differ (and with a null serviceUri it can throw a 
NullPointerException). Olingo2Component.createApiProxy then gives such an 
endpoint the shared proxy of the component configuration, so the endpoint 
serviceUri and timeouts are ignored and the requests go to the serviceUri of 
the component.
Proposed change: rewrite equals() and hashCode() with Objects.equals for each 
field.

h4. 2. An endpoint proxy replaces the shared one
{{Olingo2Component.createOlingo2App}} always assigns the new proxy to the 
component field apiProxy, also for a proxy of a single endpoint. The earlier 
shared proxy is then never closed, closeApiProxy does not close the endpoint 
proxy as it takes it for the shared one, and later endpoints with the component 
configuration use the client of that endpoint.
Proposed change: return the new proxy and assign this.apiProxy only in the 
shared branch of createApiProxy.

h4. 3. httpClientBuilder is never used
{{Olingo2Component.createOlingo2App}} only reads httpAsyncClientBuilder and 
builds a default one when it is null, so httpClientBuilder is never used and 
the synchronous client cannot be selected. The description now says "Not used".
Proposed change: use httpClientBuilder when it is set and 
httpAsyncClientBuilder is not, or deprecate the option.

h4. 4. Smaller issues
Olingo2Endpoint.interceptProperties always replaces edm with the Edm of the 
proxy, so an edm option or CamelOlingo2.edm header is ignored (the description 
now says so). keyPredicate, an extraOption in the component pom, has 
apiMethods={} and is not in the catalog. The syntax olingo2:apiName/methodName 
does not match the real URI olingo2:<method>/<resource-path>. The doc page 
example uses orderBy=, which is sent as a custom query option instead of 
$orderby, and the resource table writes $link instead of $links.


_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to