Skip to content

Commit 4ba681c

Browse files
committed
optimize get/set
1 parent 8c7ed45 commit 4ba681c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/com/alipay/global/api/BaseAlipayClient.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ public BaseAlipayClient(String gatewayUrl, String merchantPrivateKey, String ali
5252

5353
public <T extends AlipayResponse> T execute(AlipayRequest<T> alipayRequest) throws AlipayApiException {
5454

55+
// compatible with old version which clientId does not exist in BaseAlipayClient
56+
alipayRequest.setClientId(alipayRequest.getClientId() == null ? this.clientId : alipayRequest.getClientId());
57+
5558
checkRequestParam(alipayRequest);
5659

57-
String clientId = alipayRequest.getClientId() == null ? this.clientId : alipayRequest.getClientId();
60+
String clientId = alipayRequest.getClientId();
5861
String httpMethod = alipayRequest.getHttpMethod();
5962
String path = alipayRequest.getPath();
6063
Integer keyVersion = alipayRequest.getKeyVersion();
@@ -137,7 +140,7 @@ private void checkRequestParam(AlipayRequest alipayRequest) throws AlipayApiExce
137140
throw new AlipayApiException("alipayRequest can't null");
138141
}
139142

140-
String clientId = alipayRequest.getClientId() == null ? this.clientId : alipayRequest.getClientId();
143+
String clientId = alipayRequest.getClientId();
141144
String httpMethod = alipayRequest.getHttpMethod();
142145
String path = alipayRequest.getPath();
143146

0 commit comments

Comments
 (0)