mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-05 17:38:05 +08:00
🎨 优化代码,防止空指针异常
This commit is contained in:
parent
f74b00cf56
commit
9ec214b773
@ -54,8 +54,9 @@ public class SignatureExec implements ClientExecChain {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CloseableHttpResponse execute(HttpRoute route, HttpRequestWrapper request,
|
public CloseableHttpResponse execute(HttpRoute route, HttpRequestWrapper request,
|
||||||
HttpClientContext context, HttpExecutionAware execAware) throws IOException, HttpException {
|
HttpClientContext context, HttpExecutionAware execAware)
|
||||||
if (request.getURI().getHost().endsWith(".mch.weixin.qq.com")) {
|
throws IOException, HttpException {
|
||||||
|
if (request.getURI().getHost() != null && request.getURI().getHost().endsWith(".mch.weixin.qq.com")) {
|
||||||
return executeWithSignature(route, request, context, execAware);
|
return executeWithSignature(route, request, context, execAware);
|
||||||
} else {
|
} else {
|
||||||
return mainExec.execute(route, request, context, execAware);
|
return mainExec.execute(route, request, context, execAware);
|
||||||
@ -63,7 +64,8 @@ public class SignatureExec implements ClientExecChain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CloseableHttpResponse executeWithSignature(HttpRoute route, HttpRequestWrapper request,
|
private CloseableHttpResponse executeWithSignature(HttpRoute route, HttpRequestWrapper request,
|
||||||
HttpClientContext context, HttpExecutionAware execAware) throws IOException, HttpException {
|
HttpClientContext context, HttpExecutionAware execAware)
|
||||||
|
throws IOException, HttpException {
|
||||||
// 上传类不需要消耗两次故不做转换
|
// 上传类不需要消耗两次故不做转换
|
||||||
if (!(request.getOriginal() instanceof WechatPayUploadHttpPost)) {
|
if (!(request.getOriginal() instanceof WechatPayUploadHttpPost)) {
|
||||||
convertToRepeatableRequestEntity(request);
|
convertToRepeatableRequestEntity(request);
|
||||||
|
Loading…
Reference in New Issue
Block a user