Skip to content

Commit 007e736

Browse files
committed
fix some code
1 parent 9c0e9e4 commit 007e736

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/RequestHttp.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,15 @@ public interface RequestHttp<H, P> {
88
/**
99
* 返回httpClient
1010
*
11-
* @return
1211
*/
1312
H getRequestHttpClient();
1413

1514
/**
1615
* 返回httpProxy
1716
*
18-
* @return
1917
*/
2018
P getRequestHttpProxy();
2119

22-
/**
23-
* @return
24-
*/
2520
HttpType getRequestType();
2621

2722
}

weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/SimpleGetRequestExecutor.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
public abstract class SimpleGetRequestExecutor<H, P> implements RequestExecutor<String, String> {
1313
protected RequestHttp<H, P> requestHttp;
1414

15-
public SimpleGetRequestExecutor(RequestHttp requestHttp) {
15+
public SimpleGetRequestExecutor(RequestHttp<H, P> requestHttp) {
1616
this.requestHttp = requestHttp;
1717
}
1818

19-
2019
public static RequestExecutor<String, String> create(RequestHttp requestHttp) {
2120
switch (requestHttp.getRequestType()) {
2221
case APACHE_HTTP:
@@ -26,7 +25,7 @@ public static RequestExecutor<String, String> create(RequestHttp requestHttp) {
2625
case OK_HTTP:
2726
return new OkHttpSimpleGetRequestExecutor(requestHttp);
2827
default:
29-
return null;
28+
throw new IllegalArgumentException("非法请求参数");
3029
}
3130
}
3231

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/AbstractWxMpServiceImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,7 @@ public boolean oauth2validateAccessToken(WxMpOAuth2AccessToken oAuth2AccessToken
210210
String url = String.format(WxMpService.OAUTH2_VALIDATE_TOKEN_URL, oAuth2AccessToken.getAccessToken(), oAuth2AccessToken.getOpenId());
211211

212212
try {
213-
RequestExecutor<String, String> executor = SimpleGetRequestExecutor.create(this);
214-
executor.execute(url, null);
213+
SimpleGetRequestExecutor.create(this).execute(url, null);
215214
} catch (IOException e) {
216215
throw new RuntimeException(e);
217216
} catch (WxErrorException e) {

0 commit comments

Comments
 (0)