Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix NullPointerException in WxOpenXmlMessage.fromEncryptedXml method #3708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Copilot wants to merge 2 commits into develop
base: develop
Choose a base branch
Loading
from copilot/fix-3700
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ public static String wxMpOutXmlMessageToEncryptedXml(WxMpXmlOutMessage message,

public static WxOpenXmlMessage fromXml(String xml) {
//修改微信变态的消息内容格式,方便解析
xml = xml.replace("</PicList><PicList>", "");
if (xml != null) {
xml = xml.replace("</PicList><PicList>", "");
}
return XStreamTransformer.fromXml(WxOpenXmlMessage.class, xml);
}

Expand All @@ -321,6 +323,11 @@ public static WxOpenXmlMessage fromEncryptedXml(String encryptedXml, WxOpenConfi
WxOpenCryptUtil cryptUtil = new WxOpenCryptUtil(wxOpenConfigStorage);
String plainText = cryptUtil.decryptXml(msgSignature, timestamp, nonce, encryptedXml);
log.debug("解密后的原始xml消息内容:{}", plainText);

if (plainText == null || plainText.trim().isEmpty()) {
throw new WxRuntimeException("解密后的xml消息内容为空,请检查加密参数是否正确");
}

WxOpenXmlMessage wxOpenXmlMessage = fromXml(plainText);
wxOpenXmlMessage.setContext(plainText);
return wxOpenXmlMessage;
Expand Down

AltStyle によって変換されたページ (->オリジナル) /