Skip to content

Commit 556d376

Browse files
binarywangCopilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent ccbfe8e commit 556d376

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaMessage.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -638,16 +638,19 @@ public static WxMaMessage fromEncryptedJson(String encryptedJson, WxMaConfig con
638638
* @param nonce 随机串
639639
* @param msgSignature 签名串
640640
*/
641-
public static WxMaMessage fromEncryptedJson(String encryptedJson, WxMaConfig config,
642-
String timestamp, String nonce, String msgSignature) {
643-
try {
644-
WxMaMessage encryptedMessage = fromJson(encryptedJson);
645-
String plainText = new WxMaCryptUtils(config).decryptContent(msgSignature, timestamp, nonce,
646-
encryptedMessage.getEncrypt());
647-
return fromJson(plainText);
648-
} catch (Exception e) {
649-
throw new WxRuntimeException(e);
650-
}
641+
public static WxMaMessage fromEncryptedJson(String encryptedJson, WxMaConfig config,
642+
String timestamp, String nonce, String msgSignature) {
643+
try {
644+
WxMaMessage encryptedMessage = fromJson(encryptedJson);
645+
String plainText = new WxMaCryptUtils(config).decryptContent(msgSignature, timestamp, nonce,
646+
encryptedMessage.getEncrypt());
647+
return fromJson(plainText);
648+
} catch (WxRuntimeException e) {
649+
throw e;
650+
} catch (Exception e) {
651+
throw new WxRuntimeException(e);
652+
}
653+
}
651654
}
652655

653656
public static WxMaMessage fromEncryptedJson(InputStream inputStream, WxMaConfig config) {

0 commit comments

Comments
 (0)