Skip to content

Commit 5a65e2b

Browse files
committed
Merge branch 'RM-3489_fix_apiclient_timeouts' into 'master'
RM-3489: Create workaround for bug in ApiClient. Calling ApiClient.setDebbugging(boolean) rebuilds httpclient and that invalidates previous httpclient properties set by ApiClient.setConnectTimeout(int). See merge request cdoc2/cdoc2-java-ref-impl!26
2 parents 679b1d8 + 20f318a commit 5a65e2b

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

cdoc2-cli/config/localhost/localhost_pkcs12.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ cdoc2.client.server.id=localhost
77
cdoc2.client.server.base-url.post=https://localhost:8443
88
# Quering capsules requires mTLS
99
cdoc2.client.server.base-url.get=https://localhost:8444
10+
1011
cdoc2.client.server.debug=true
12+
cdoc2.client.server.connect-timeout=1000
13+
cdoc2.client.server.read-timeout=1000
1114

1215
# trusted certificates by client
1316
cdoc2.client.ssl.trust-store.type=JKS

cdoc2-cli/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</parent>
99

1010
<artifactId>cdoc2-cli</artifactId>
11-
<version>1.4.0</version>
11+
<version>1.4.1-SNAPSHOT</version>
1212
<description>Command line utility to create/process CDOC2 files</description>
1313

1414
<properties>
@@ -42,7 +42,7 @@
4242
<dependency>
4343
<groupId>ee.cyber.cdoc2</groupId>
4444
<artifactId>cdoc2-lib</artifactId>
45-
<version>1.4.0</version>
45+
<version>1.4.1-SNAPSHOT</version>
4646
</dependency>
4747
</dependencies>
4848

cdoc2-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</parent>
99

1010
<artifactId>cdoc2-client</artifactId>
11-
<version>1.4.0</version>
11+
<version>1.4.1-SNAPSHOT</version>
1212
<description>CDOC2 server client generation from openapi specification</description>
1313

1414
<properties>

cdoc2-client/src/main/java/ee/cyber/cdoc2/client/Cdoc2KeyCapsuleApiClient.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,19 @@ protected void customizeClientBuilder(ClientBuilder clientBuilder) {
169169
}
170170
};
171171

172+
// BUG in openapi-generator ApiClient, {@link org.openapitools.client.ApiClient#setDebugging}
173+
// overwrites already set httpclient properties, like setConnectTimeout()
174+
// setDebugging must be called first, same with setClientConfig and other methods that
175+
// call ApiClient#buildHttpClient()
176+
apiClient.setDebugging(debug);
177+
172178
apiClient.setBasePath(this.baseUrl);
179+
180+
log.debug("Setting connect timeout to {}", connectTimeoutMs);
173181
apiClient.setConnectTimeout(connectTimeoutMs);
182+
log.debug("Setting read timeout to {}", readTimeoutMs);
174183
apiClient.setReadTimeout(readTimeoutMs);
175184

176-
apiClient.setDebugging(debug);
177185
apiClient.addDefaultHeader("Accept", "application/json");
178186
apiClient.selectHeaderAccept("application/json");
179187

cdoc2-lib/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<modelVersion>4.0.0</modelVersion>
99

1010
<artifactId>cdoc2-lib</artifactId>
11-
<version>1.4.0</version>
11+
<version>1.4.1-SNAPSHOT</version>
1212
<description>CDOC2 creation and processing library</description>
1313

1414
<properties>
@@ -26,7 +26,7 @@
2626
<dependency>
2727
<groupId>ee.cyber.cdoc2</groupId>
2828
<artifactId>cdoc2-client</artifactId>
29-
<version>1.4.0</version>
29+
<version>1.4.1-SNAPSHOT</version>
3030
</dependency>
3131

3232
<dependency>

0 commit comments

Comments
 (0)