From 7645d05a95c3ce9170a557d2f36e267e2e68b1aa Mon Sep 17 00:00:00 2001 From: EmmetZC Date: Fri, 11 Apr 2025 19:20:38 +0800 Subject: [PATCH] fix issues wechatpay-apiv3#359 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 此前没有正确使用 try-with-resources 语法 Signed-off-by: EmmetZC --- .../pay/java/core/http/apache/ApacheHttpClientAdapter.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/wechat/pay/java/core/http/apache/ApacheHttpClientAdapter.java b/core/src/main/java/com/wechat/pay/java/core/http/apache/ApacheHttpClientAdapter.java index bb21ba09..196f9569 100644 --- a/core/src/main/java/com/wechat/pay/java/core/http/apache/ApacheHttpClientAdapter.java +++ b/core/src/main/java/com/wechat/pay/java/core/http/apache/ApacheHttpClientAdapter.java @@ -55,9 +55,8 @@ protected String getHttpClientInfo() { @Override public OriginalResponse innerExecute(HttpRequest wechatPayRequest) { - try { - CloseableHttpResponse apacheHttpResponse = - apacheHttpClient.execute(buildApacheHttpRequest(wechatPayRequest)); + try (CloseableHttpResponse apacheHttpResponse = + apacheHttpClient.execute(buildApacheHttpRequest(wechatPayRequest))) { return assembleOriginalResponse(wechatPayRequest, apacheHttpResponse); } catch (IOException e) { throw new HttpException(wechatPayRequest, e);