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);