[xwiki/xwiki-platform] 40533d: [Misc] Add a null guard in XWiki#getDocumentRefere...
Branch: refs/heads/claude/null-guard-check-deleting-document Home: https://github.com/xwiki/xwiki-platform Commit: 40533d5dc9680778669396ec804510cb0238a17a https://github.com/xwiki/xwiki-platform/commit/40533d5dc9680778669396ec80451... Author: Vincent Massol <[email protected]> Date: 2026-09-14 (Mon, 14 Sep 2026) Changed paths: M xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java M xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/XWikiMockitoTest.java Log Message: ----------- [Misc] Add a null guard in XWiki#getDocumentReference for the XML-RPC mode * In XML-RPC mode the current document was dereferenced twice with no null check, while XWikiContext#getDoc() is documented as nullable and the main caller (prepareDocuments) calls this very method to find out which document is requested, i.e. before any document is in the context. Fall back on the wiki's home page in that case, as the portlet mode already does. This fixes the javabugs:S2259 SonarCloud issue reported on that method * Extract the XML-RPC branch into a private method so that the added condition doesn't push getDocumentReference() over the allowed cognitive complexity * Add unit tests for both XML-RPC cases Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> To unsubscribe from these emails, change your notification settings at https://github.com/xwiki/xwiki-platform/settings/notifications
participants (1)
-
XWiki Notifications