diff --git a/core/src/main/java/com/wechat/pay/java/core/http/okhttp/OkHttpClientAdapter.java b/core/src/main/java/com/wechat/pay/java/core/http/okhttp/OkHttpClientAdapter.java index a47cec00..4cc09465 100644 --- a/core/src/main/java/com/wechat/pay/java/core/http/okhttp/OkHttpClientAdapter.java +++ b/core/src/main/java/com/wechat/pay/java/core/http/okhttp/OkHttpClientAdapter.java @@ -150,8 +150,7 @@ private OriginalResponse assembleOriginalResponse( @Override protected InputStream innerDownload(HttpRequest httpRequest) { Request okHttpRequest = buildOkHttpRequest(httpRequest); - try { - Response okHttpResponse = okHttpClient.newCall(okHttpRequest).execute(); + try (Response okHttpResponse = okHttpClient.newCall(okHttpRequest).execute()) { if (isInvalidHttpCode(okHttpResponse.code())) { throw new ServiceException(httpRequest, okHttpResponse.code(), ""); }