[
https://issues.apache.org/jira/browse/CAMEL-12740?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-12740:
--------------------------------
Fix Version/s: 2.23.0
> Olingo4Component creates and ignores HttpAsyncClientBuilder
> -----------------------------------------------------------
>
> Key: CAMEL-12740
> URL: https://issues.apache.org/jira/browse/CAMEL-12740
> Project: Camel
> Issue Type: Bug
> Components: camel-olingo4
> Affects Versions: 2.22.0
> Reporter: Jeroen NB
> Priority: Major
> Fix For: 2.22.1, 2.23.0
>
>
> The Olingo4Component will create an instance of HttpAsyncClientBuilder is the
> provided Olingo4Configuration does not contain one. The new instance of
> HttpAsyncClientBuilder will be configured with timeout settings, proxy and
> SSL, but will never be used.
> Extract from Olingo4Component.createOlingo4App:
> {code:java}
> Object clientBuilder = configuration.getHttpAsyncClientBuilder();
> if (clientBuilder == null) {
> HttpAsyncClientBuilder asyncClientBuilder =
> HttpAsyncClientBuilder.create();
> Builder requestConfigBuilder = RequestConfig.custom();
> requestConfigBuilder.setConnectTimeout(configuration.getConnectTimeout());
> requestConfigBuilder.setSocketTimeout(configuration.getSocketTimeout());
> HttpHost proxy = configuration.getProxy();
> if (proxy != null) {
> requestConfigBuilder.setProxy(proxy);
> }
> asyncClientBuilder.setDefaultRequestConfig(requestConfigBuilder.build());
> SSLContextParameters sslContextParameters =
> configuration.getSslContextParameters();
> if (sslContextParameters == null) {
> sslContextParameters = this.retrieveGlobalSslContextParameters();
> }
> if (sslContextParameters == null) {
> sslContextParameters = new SSLContextParameters();
> }
> try {
>
> asyncClientBuilder.setSSLContext(sslContextParameters.createSSLContext(this.getCamelContext()));
> } catch (GeneralSecurityException var8) {
> throw ObjectHelper.wrapRuntimeCamelException(var8);
> } catch (IOException var9) {
> throw ObjectHelper.wrapRuntimeCamelException(var9);
> }
> }
> Olingo4AppImpl olingo4App;
> if (clientBuilder != null && !(clientBuilder instanceof
> HttpAsyncClientBuilder)) {
> olingo4App = new Olingo4AppImpl(configuration.getServiceUri(),
> (HttpClientBuilder)clientBuilder);
> } else {
> olingo4App = new Olingo4AppImpl(configuration.getServiceUri(),
> (HttpAsyncClientBuilder)clientBuilder);
> }
> {code}
> The class Olingo4AppImpl gets a null clientBuilder reference and then
> instantiates its own:
> {code:java}
> public Olingo4AppImpl(String serviceUri, HttpAsyncClientBuilder builder) {
> this.odataClient = ODataClientFactory.getClient();
> this.odataReader = this.odataClient.getReader();
> this.odataWriter = this.odataClient.getWriter();
> this.setServiceUri(serviceUri);
> CloseableHttpAsyncClient asyncClient;
> if (builder == null) {
> asyncClient = HttpAsyncClients.createDefault();
> } else {
> asyncClient = builder.build();
> }
> asyncClient.start();
> this.client = asyncClient;
> this.contentType = DEFAULT_CONTENT_TYPE;
> }
> {code}
> Because of this, none of the Olingo4Configuration settings are used and for
> example connect and socket timeout defaults to -1.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)