mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-06-28 13:16:19 +08:00
🐛 修复小程序发送请求方法空指针异常问题
This commit is contained in:
parent
7b161b1abb
commit
9c6fca77e6
@ -343,12 +343,14 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
|
|||||||
public <R, T> R execute(RequestExecutor<R, T> executor, String uri, T data)
|
public <R, T> R execute(RequestExecutor<R, T> executor, String uri, T data)
|
||||||
throws WxErrorException {
|
throws WxErrorException {
|
||||||
String dataForLog;
|
String dataForLog;
|
||||||
if (data instanceof String) {
|
if (data == null) {
|
||||||
|
dataForLog = null;
|
||||||
|
} else if (data instanceof String) {
|
||||||
dataForLog = DataUtils.handleDataWithSecret((String) data);
|
dataForLog = DataUtils.handleDataWithSecret((String) data);
|
||||||
} else {
|
} else {
|
||||||
dataForLog = data.toString();
|
dataForLog = data.toString();
|
||||||
}
|
}
|
||||||
return excuteWithRetry(
|
return executeWithRetry(
|
||||||
(uriWithAccessToken) -> executor.execute(uriWithAccessToken, data, WxType.MiniApp),
|
(uriWithAccessToken) -> executor.execute(uriWithAccessToken, data, WxType.MiniApp),
|
||||||
uri,
|
uri,
|
||||||
dataForLog);
|
dataForLog);
|
||||||
@ -362,7 +364,7 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
|
|||||||
String data)
|
String data)
|
||||||
throws WxErrorException {
|
throws WxErrorException {
|
||||||
String dataForLog = "Headers: " + headers.toString() + " Body: " + data;
|
String dataForLog = "Headers: " + headers.toString() + " Body: " + data;
|
||||||
return excuteWithRetry(
|
return executeWithRetry(
|
||||||
(uriWithAccessToken) -> executor.execute(uriWithAccessToken, headers, data, WxType.MiniApp),
|
(uriWithAccessToken) -> executor.execute(uriWithAccessToken, headers, data, WxType.MiniApp),
|
||||||
uri,
|
uri,
|
||||||
dataForLog);
|
dataForLog);
|
||||||
@ -372,7 +374,7 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
|
|||||||
R execute(String urlWithAccessToken) throws IOException, WxErrorException;
|
R execute(String urlWithAccessToken) throws IOException, WxErrorException;
|
||||||
}
|
}
|
||||||
|
|
||||||
private <R, T> R excuteWithRetry(ExecutorAction<R> executor, String uri, String dataForLog)
|
private <R, T> R executeWithRetry(ExecutorAction<R> executor, String uri, String dataForLog)
|
||||||
throws WxErrorException {
|
throws WxErrorException {
|
||||||
int retryTimes = 0;
|
int retryTimes = 0;
|
||||||
do {
|
do {
|
||||||
|
Loading…
Reference in New Issue
Block a user