Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c91a5a8

Browse filesBrowse files
authored
🎨 【微信支付】修复连接池关闭异常问题
1 parent a051587 commit c91a5a8
Copy full SHA for c91a5a8

File tree

Expand file treeCollapse file tree

1 file changed

+9
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-12
lines changed

‎weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java

Copy file name to clipboardExpand all lines: weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java
+9-12Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ public String postV3(String url, String requestStr) throws WxPayException {
105105
}
106106

107107
private String requestV3(String url, String requestStr, HttpRequestBase httpRequestBase) throws WxPayException {
108-
try (CloseableHttpClient httpClient = this.createApiV3HttpClient();
109-
CloseableHttpResponse response = httpClient.execute(httpRequestBase)) {
108+
CloseableHttpClient httpClient = this.createApiV3HttpClient();
109+
try (CloseableHttpResponse response = httpClient.execute(httpRequestBase)) {
110110
//v3已经改为通过状态码判断200 204 成功
111111
int statusCode = response.getStatusLine().getStatusCode();
112112
//post方法有可能会没有返回值的情况
@@ -142,8 +142,8 @@ public String patchV3(String url, String requestStr) throws WxPayException {
142142
public String postV3WithWechatpaySerial(String url, String requestStr) throws WxPayException {
143143
HttpPost httpPost = this.createHttpPost(url, requestStr);
144144
this.configureRequest(httpPost);
145-
try (CloseableHttpClient httpClient = this.createApiV3HttpClient();
146-
CloseableHttpResponse response = httpClient.execute(httpPost)) {
145+
CloseableHttpClient httpClient = this.createApiV3HttpClient();
146+
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
147147
//v3已经改为通过状态码判断200 204 成功
148148
int statusCode = response.getStatusLine().getStatusCode();
149149
String responseString = "{}";
@@ -178,9 +178,8 @@ public String postV3(String url, HttpPost httpPost) throws WxPayException {
178178
@Override
179179
public String requestV3(String url, HttpRequestBase httpRequest) throws WxPayException {
180180
this.configureRequest(httpRequest);
181-
182-
try (CloseableHttpClient httpClient = this.createApiV3HttpClient();
183-
CloseableHttpResponse response = httpClient.execute(httpRequest)) {
181+
CloseableHttpClient httpClient = this.createApiV3HttpClient();
182+
try (CloseableHttpResponse response = httpClient.execute(httpRequest)) {
184183
//v3已经改为通过状态码判断200 204 成功
185184
int statusCode = response.getStatusLine().getStatusCode();
186185
//post方法有可能会没有返回值的情况
@@ -223,11 +222,9 @@ public String getV3WithWechatPaySerial(String url) throws WxPayException {
223222
@Override
224223
public InputStream downloadV3(String url) throws WxPayException {
225224
HttpGet httpGet = new WxPayV3DownloadHttpGet(url);
226-
httpGet.addHeader(ACCEPT, ContentType.WILDCARD.getMimeType());
227-
String serialNumber = getWechatPaySerial(getConfig());
228-
httpGet.addHeader(WECHAT_PAY_SERIAL, serialNumber);
229-
try (CloseableHttpClient httpClient = this.createApiV3HttpClient();
230-
CloseableHttpResponse response = httpClient.execute(httpGet)) {
225+
this.configureRequest(httpGet);
226+
CloseableHttpClient httpClient = this.createApiV3HttpClient();
227+
try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
231228
//v3已经改为通过状态码判断200 204 成功
232229
int statusCode = response.getStatusLine().getStatusCode();
233230
Header contentType = response.getFirstHeader(HttpHeaders.CONTENT_TYPE);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.