Claus Ibsen created CAMEL-27978:
-----------------------------------

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


Found while improving the option descriptions of camel-olingo4 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. Olingo4Configuration.equals() compares too little
{{Olingo4Configuration.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). Olingo4Component.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
{{Olingo4Component.createOlingo4App}} 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
{{Olingo4Component.createOlingo4App}} 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. delete fetches $metadata without the endpoint headers
{{Olingo4AppImpl.delete}} calls augmentWithETag with edm=null, so every delete 
first reads $metadata without the endpointHttpHeaders and never caches it. A 
service that needs those headers (a token, for example) fails the delete.
Proposed change: pass the Edm the endpoint already has, and the 
endpointHttpHeaders, to delete.

h4. 5. Smaller issues
Olingo4Endpoint.interceptProperties always replaces edm with the Edm of the 
proxy, so an edm option or CamelOlingo4.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 olingo4:apiName/methodName 
does not match the real URI olingo4:<method>/<resource-path>.


_Claude Code on behalf of davsclaus_



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

Reply via email to