fix: pass QJsonParseError to QJsonDocument::fromJson in fromJsonString - #1704
fix: pass QJsonParseError to QJsonDocument::fromJson in fromJsonString#1704MyLeeJiEun wants to merge 1 commit into
Conversation
|
Hi @MyLeeJiEun. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR wires QJsonParseError into DPluginMetaData::fromJsonString so JSON parsing failures are correctly detected, logged, and routed through the existing error branch instead of being silently ignored. Sequence diagram for updated JSON parsing in DPluginMetaData::fromJsonStringsequenceDiagram
participant Caller
participant DPluginMetaData
participant QJsonDocument
participant Logger
Caller->>DPluginMetaData: fromJsonString(data)
activate DPluginMetaData
DPluginMetaData->>QJsonDocument: fromJson(data, &error)
QJsonDocument-->>DPluginMetaData: QJsonDocument
alt [error.error]
DPluginMetaData->>Logger: qCWarning(dsLog)
DPluginMetaData-->>Caller: DPluginMetaData()
else [no parse error]
DPluginMetaData-->>Caller: DPluginMetaData (from metaData)
end
deactivate DPluginMetaData
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
1. Pass &error to QJsonDocument::fromJson in fromJsonString 2. Make the QJsonParseError error branch reachable, removing dead code 3. Malformed JSON now triggers qCWarning and returns invalid DPluginMetaData 4. Update SPDX copyright year to 2023 - 2026 Influence: 1. Load plugins with valid JSON metadata, verify normal plugin loading 2. Load a plugin with malformed JSON, verify qCWarning is logged 3. Verify malformed JSON plugin is skipped without crashing the shell fix: 向 QJsonDocument::fromJson 传入 &error 1. 向 fromJsonString 中的 QJsonDocument::fromJson 传入 &error 出参 2. 使 QJsonParseError 错误分支可达,消除死代码 3. 非法 JSON 现触发 qCWarning 并返回 invalid DPluginMetaData 4. 更新 SPDX 版权年份为 2023 - 2026 Influence: 1. 加载合法 JSON 元数据的插件,验证插件正常加载 2. 加载包含非法 JSON 的插件,验证触发 qCWarning 日志 3. 验证非法 JSON 插件被跳过且不影响 dde-shell 启动 Refs: DDE-132
a51ccc1 to
8970acd
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, MyLeeJiEun The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Summary
Pass
&errortoQJsonDocument::fromJsoninDPluginMetaData::fromJsonStringso theQJsonParseErrorerror branch becomes reachable. Fixes a dead-code defect where malformed JSON was silently swallowed and theqCWarningdiagnostic never fired.Change
frame/pluginmetadata.cpp:QJsonDocument::fromJson(data)→QJsonDocument::fromJson(data, &error)infromJsonString.Behavior
qCWarningwith the parse error string, and returns an invalidDPluginMetaData(previously returned invalid via the missing-Idpath, silently).Testing
DPluginMetaData.FromJsonStringMalformedunit test still passes — it asserts an invalid result both before and after the fix, so no test update is needed. The previously-unreachable error branch is now reachable for coverage.Related
Summary by Sourcery
Make JSON parsing errors reachable so malformed plugin metadata is rejected with diagnostic logging.
Bug Fixes:
Chores: