From 13f9c64643c72433207ab4b53dd2a43d7b1c23f6 Mon Sep 17 00:00:00 2001 From: terminux Date: Thu, 17 Aug 2023 12:54:01 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E5=88=9D=E5=A7=8B=E5=8C=96v3=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF=E6=97=B6=EF=BC=8C=E6=9C=AA=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E8=AF=81=E4=B9=A6=E5=BA=8F=E5=88=97=E5=8F=B7=E5=80=BC=E6=89=8D?= =?UTF-8?q?=E5=B0=9D=E8=AF=95=E5=8A=A0=E8=BD=BD=E8=AF=81=E4=B9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/github/binarywang/wxpay/config/WxPayConfig.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java index e6a266640..41ac7fcbf 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java @@ -262,12 +262,12 @@ public class WxPayConfig { InputStream keyInputStream = this.loadConfigInputStream(this.getPrivateKeyString(), this.getPrivateKeyPath(), this.privateKeyContent, "privateKeyPath"); - InputStream certInputStream = this.loadConfigInputStream(this.getPrivateCertString(), this.getPrivateCertPath(), - this.privateCertContent, "privateCertPath"); try { PrivateKey merchantPrivateKey = PemUtils.loadPrivateKey(keyInputStream); - X509Certificate certificate = PemUtils.loadCertificate(certInputStream); if (StringUtils.isBlank(this.getCertSerialNo())) { + InputStream certInputStream = this.loadConfigInputStream(this.getPrivateCertString(), this.getPrivateCertPath(), + this.privateCertContent, "privateCertPath"); + X509Certificate certificate = PemUtils.loadCertificate(certInputStream); this.certSerialNo = certificate.getSerialNumber().toString(16).toUpperCase(); } //构造Http Proxy正向代理 @@ -290,6 +290,8 @@ public class WxPayConfig { this.privateKey = merchantPrivateKey; return httpClient; + } catch (WxPayException e) { + throw e; } catch (Exception e) { throw new WxPayException("v3请求构造异常!", e); }