This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 042c8cd (chores) Cleanup closing the resources on the
AS2AsynchronousMDNManager (#4885)
042c8cd is described below
commit 042c8cdb1b9873a490e5cb2aeea5609ffc25a2f5
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Thu Jan 14 17:40:57 2021 +0100
(chores) Cleanup closing the resources on the AS2AsynchronousMDNManager
(#4885)
The class is auto closeable and the flush is already performed during
close
---
.../camel/component/as2/api/AS2AsynchronousMDNManager.java | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git
a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2AsynchronousMDNManager.java
b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2AsynchronousMDNManager.java
index 0e5ad52..cb38bb0 100644
---
a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2AsynchronousMDNManager.java
+++
b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2AsynchronousMDNManager.java
@@ -121,9 +121,9 @@ public class AS2AsynchronousMDNManager {
String requestUri = buildRequestURI(uri);
- DefaultBHttpClientConnection httpConnection = new
DefaultBHttpClientConnection(8 * 1024);
+ int buffSize = 8 * 1024;
- try {
+ try (DefaultBHttpClientConnection httpConnection = new
DefaultBHttpClientConnection(buffSize)) {
HttpHost targetHost = new HttpHost(uri.getHost(), uri.getPort(),
uri.getScheme());
@@ -154,13 +154,6 @@ public class AS2AsynchronousMDNManager {
return httpContext;
} catch (Exception e) {
throw new HttpException("failed to send MDN", e);
- } finally {
- try {
- httpConnection.flush();
- httpConnection.close();
- } catch (IOException e) {
- // Ignore.
- }
}
}